public class ResolvingKetamaClient extends AbstractRawMemcacheClient
| Modifier and Type | Class and Description |
|---|---|
static interface |
ResolvingKetamaClient.Connector |
private class |
ResolvingKetamaClient.MyConnectionChangeListener |
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<HostAndPort,RawMemcacheClient> |
clients |
private ResolvingKetamaClient.Connector |
connector |
private RawMemcacheClient |
currentClient |
private java.util.concurrent.ScheduledExecutorService |
executor |
private ResolvingKetamaClient.MyConnectionChangeListener |
listener |
private static org.slf4j.Logger |
log |
static int |
MAX_RESOLVE_WAIT_TIME |
static int |
MIN_RESOLVE_WAIT_TIME |
private RawMemcacheClient |
pendingClient |
private java.util.concurrent.ScheduledFuture<?> |
refreshJob |
private Resolver |
resolver |
private boolean |
shutdown |
private long |
shutdownDelay |
private java.util.Collection<RawMemcacheClient> |
shutdownQueue |
private java.util.concurrent.TimeUnit |
shutdownUnit |
private java.lang.Object |
sync |
private long |
ttl |
| Constructor and Description |
|---|
ResolvingKetamaClient(Resolver resolver,
java.util.concurrent.ScheduledExecutorService executor,
long period,
java.util.concurrent.TimeUnit periodUnit,
ResolvingKetamaClient.Connector connector,
long shutdownDelay,
java.util.concurrent.TimeUnit shutdownUnit) |
| Modifier and Type | Method and Description |
|---|---|
private long |
clamp(int min,
int max,
long value) |
java.lang.Throwable |
getConnectionFailure()
Returns the unrecoverable connection failure, if any.
|
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.
|
void |
resolve() |
<T> java.util.concurrent.CompletionStage<T> |
send(Request<T> request) |
private void |
setPendingClient(com.google.common.collect.ImmutableList.Builder<RawMemcacheClient> removedClients) |
void |
shutdown()
Shut down the client.
|
void |
start() |
notifyConnectionChange, registerForConnectionChanges, unregisterForConnectionChangesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitawaitConnected, awaitDisconnected, awaitFullyConnected, awaitFullyDisconnected, awaitFuture, connectFuture, disconnectFuture, fullyConnectedFuture, fullyDisconnectFutureprivate static final org.slf4j.Logger log
public static final int MIN_RESOLVE_WAIT_TIME
public static final int MAX_RESOLVE_WAIT_TIME
private final java.util.concurrent.ScheduledExecutorService executor
private final Resolver resolver
private final long ttl
private final ResolvingKetamaClient.Connector connector
private final long shutdownDelay
private final java.util.concurrent.TimeUnit shutdownUnit
private final ResolvingKetamaClient.MyConnectionChangeListener listener
private java.util.concurrent.ScheduledFuture<?> refreshJob
private final java.lang.Object sync
private final java.util.Map<HostAndPort,RawMemcacheClient> clients
private final java.util.Collection<RawMemcacheClient> shutdownQueue
private volatile RawMemcacheClient currentClient
private volatile RawMemcacheClient pendingClient
private boolean shutdown
public ResolvingKetamaClient(Resolver resolver, java.util.concurrent.ScheduledExecutorService executor, long period, java.util.concurrent.TimeUnit periodUnit, ResolvingKetamaClient.Connector connector, long shutdownDelay, java.util.concurrent.TimeUnit shutdownUnit)
public void start()
public void resolve()
private long clamp(int min,
int max,
long value)
public <T> java.util.concurrent.CompletionStage<T> send(Request<T> request)
public void shutdown()
RawMemcacheClientObservableClient.registerForConnectionChanges(ConnectionChangeListener) to to
get notified when it has (possibly) finished shutting downpublic boolean isConnected()
ObservableClientpublic java.lang.Throwable getConnectionFailure()
ObservableClientpublic int numTotalConnections()
RawMemcacheClientpublic int numActiveConnections()
RawMemcacheClientprivate void setPendingClient(com.google.common.collect.ImmutableList.Builder<RawMemcacheClient> removedClients)
Copyright © 2020 Spotify AB. All Rights Reserved.