public class KestrelServerSpec extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_KESTREL_MEMCACHED_PORT
the default kestrel memcached port
|
static int |
DEFAULT_KESTREL_TEXT_PORT
the default kestrel text protocol port
|
static int |
DEFAULT_KESTREL_THRIFT_PORT
the default kestrel thrift port
|
String |
host
the kestrel host
|
static String |
LOCALHOST
the localhost
|
int |
port
the kestrel host port
|
| Constructor and Description |
|---|
KestrelServerSpec(String kestrelHost,
int port)
A single kestrel host
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
KestrelThriftClient |
getValidClient()
Get a valid Kestrel client, reconnecting if necessary
|
static String |
kestrelAddressListAsString(List<KestrelServerSpec> kestrelSpecList,
int port)
Construct a string that looks like this: "host1:port1 host2:port2" from
the list of
KestrelServerSpec |
static KestrelServerSpec |
localMemcached() |
static KestrelServerSpec |
localText() |
static KestrelServerSpec |
localThrift() |
static List<KestrelServerSpec> |
parseKestrelAddressList(List<String> kestrelHosts)
Parse a list of strings in the format: host:port.
|
static Iterator<KestrelThriftClient> |
thriftClientIterator(List<KestrelServerSpec> kestrelSpecList)
An iterator to access a list of
KestrelServerSpec in a round
robin fasion. |
public static final int DEFAULT_KESTREL_MEMCACHED_PORT
public static final int DEFAULT_KESTREL_THRIFT_PORT
public static final int DEFAULT_KESTREL_TEXT_PORT
public static final String LOCALHOST
public int port
public KestrelServerSpec(String kestrelHost, int port)
kestrelHost - port - public static KestrelServerSpec localMemcached()
public static KestrelServerSpec localThrift()
public static KestrelServerSpec localText()
public static List<KestrelServerSpec> parseKestrelAddressList(List<String> kestrelHosts)
kestrelHosts - public static String kestrelAddressListAsString(List<KestrelServerSpec> kestrelSpecList, int port)
KestrelServerSpeckestrelSpecList - port - public KestrelThriftClient getValidClient() throws org.apache.thrift7.TException
org.apache.thrift7.TExceptionpublic static Iterator<KestrelThriftClient> thriftClientIterator(List<KestrelServerSpec> kestrelSpecList)
KestrelServerSpec in a round
robin fasion. This iterator will always return a next as long as there
are KestrelServerSpec in the provided list.kestrelSpecList - public void close()