public class SrvKetamaClient extends AbstractRawMemcacheClient
| Modifier and Type | Class and Description |
|---|---|
static interface |
SrvKetamaClient.Connector |
private static class |
SrvKetamaClient.HostAndPortComparator |
private class |
SrvKetamaClient.MyConnectionChangeListener |
private class |
SrvKetamaClient.ShutdownJob |
| Modifier and Type | Field and Description |
|---|---|
private List<com.google.common.net.HostAndPort> |
addresses |
private SrvKetamaClient.Connector |
connector |
private RawMemcacheClient |
currentClient |
private ScheduledExecutorService |
executor |
private SrvKetamaClient.MyConnectionChangeListener |
listener |
private static org.slf4j.Logger |
log |
private RawMemcacheClient |
pendingClient |
private long |
period |
private TimeUnit |
periodUnit |
private ScheduledFuture<?> |
refreshJob |
private boolean |
shutdown |
private long |
shutdownDelay |
private TimeUnit |
shutdownUnit |
private String |
srvRecord |
private com.spotify.dns.DnsSrvResolver |
srvResolver |
private Object |
sync |
| Constructor and Description |
|---|
SrvKetamaClient(String srvRecord,
com.spotify.dns.DnsSrvResolver srvResolver,
ScheduledExecutorService executor,
long period,
TimeUnit periodUnit,
SrvKetamaClient.Connector connector,
long shutdownDelay,
TimeUnit shutdownUnit) |
| Modifier and Type | Method and Description |
|---|---|
private List<AddressAndClient> |
getAddressesAndClients(List<com.google.common.net.HostAndPort> newAddresses) |
boolean |
isConnected()
Is the client connected to a server?
|
int |
numActiveConnections()
How many active socket connections do we have (i.e.
|
int |
numTotalConnections()
How many actual socket connections do we have, including currently disconnected clients.
|
<T> com.google.common.util.concurrent.ListenableFuture<T> |
send(Request<T> request) |
private void |
setPendingClient(List<AddressAndClient> addressAndClients) |
void |
shutdown()
Shut down the client.
|
void |
start() |
void |
updateDNS() |
notifyConnectionChange, registerForConnectionChanges, unregisterForConnectionChangesprivate static final org.slf4j.Logger log
private final ScheduledExecutorService executor
private final String srvRecord
private final com.spotify.dns.DnsSrvResolver srvResolver
private final long period
private final TimeUnit periodUnit
private final SrvKetamaClient.Connector connector
private final long shutdownDelay
private final TimeUnit shutdownUnit
private final SrvKetamaClient.MyConnectionChangeListener listener
private ScheduledFuture<?> refreshJob
private final Object sync
private volatile List<com.google.common.net.HostAndPort> addresses
private volatile RawMemcacheClient currentClient
private volatile RawMemcacheClient pendingClient
private boolean shutdown
public SrvKetamaClient(String srvRecord, com.spotify.dns.DnsSrvResolver srvResolver, ScheduledExecutorService executor, long period, TimeUnit periodUnit, SrvKetamaClient.Connector connector, long shutdownDelay, TimeUnit shutdownUnit)
public void start()
public void updateDNS()
private List<AddressAndClient> getAddressesAndClients(List<com.google.common.net.HostAndPort> newAddresses)
public <T> com.google.common.util.concurrent.ListenableFuture<T> send(Request<T> request)
public void shutdown()
RawMemcacheClientRawMemcacheClient.registerForConnectionChanges(ConnectionChangeListener) to
to get notified when it has (possibly) finished shutting downpublic boolean isConnected()
RawMemcacheClientpublic int numTotalConnections()
RawMemcacheClientpublic int numActiveConnections()
RawMemcacheClientprivate void setPendingClient(List<AddressAndClient> addressAndClients)
Copyright © 2015 Spotify AB. All Rights Reserved.