public class ReconnectingClient extends AbstractRawMemcacheClient
| Modifier and Type | Class and Description |
|---|---|
static class |
ReconnectingClient.StandardReconnectionListener
This class should be regarded as internal API.
|
| Modifier and Type | Field and Description |
|---|---|
private HostAndPort |
address |
private BackoffFunction |
backoffFunction |
private RawMemcacheClient |
client |
private java.lang.Throwable |
connectionFailure |
private Connector |
connector |
private static org.slf4j.Logger |
log |
private int |
reconnectCount |
private ReconnectionListener |
reconnectionListener |
private static java.util.concurrent.ScheduledExecutorService |
SCHEDULED_EXECUTOR_SERVICE |
private java.util.concurrent.ScheduledExecutorService |
scheduledExecutorService |
private boolean |
stayConnected |
| Modifier | Constructor and Description |
|---|---|
private |
ReconnectingClient(BackoffFunction backoffFunction,
java.util.concurrent.ScheduledExecutorService scheduledExecutorService,
Connector connector,
Authenticator authenticator,
HostAndPort address,
ReconnectionListener reconnectionListener) |
(package private) |
ReconnectingClient(BackoffFunction backoffFunction,
java.util.concurrent.ScheduledExecutorService scheduledExecutorService,
Connector connector,
HostAndPort address,
ReconnectionListener reconnectionListener) |
|
ReconnectingClient(BackoffFunction backoffFunction,
java.util.concurrent.ScheduledExecutorService scheduledExecutorService,
HostAndPort address,
int outstandingRequestLimit,
int eventLoopThreadFlushMaxBatchSize,
boolean binary,
Authenticator authenticator,
java.util.concurrent.Executor executor,
long connectionTimeoutMillis,
java.nio.charset.Charset charset,
Metrics metrics,
int maxSetLength,
io.netty.channel.EventLoopGroup eventLoopGroup,
java.lang.Class<? extends io.netty.channel.Channel> channelClass) |
|
ReconnectingClient(BackoffFunction backoffFunction,
java.util.concurrent.ScheduledExecutorService scheduledExecutorService,
HostAndPort address,
ReconnectionListener reconnectionListener,
int outstandingRequestLimit,
int eventLoopThreadFlushMaxBatchSize,
boolean binary,
Authenticator authenticator,
java.util.concurrent.Executor executor,
long connectionTimeoutMillis,
java.nio.charset.Charset charset,
Metrics metrics,
int maxSetLength,
io.netty.channel.EventLoopGroup eventLoopGroup,
java.lang.Class<? extends io.netty.channel.Channel> channelClass) |
| Modifier and Type | Method and Description |
|---|---|
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 |
numPendingRequests() |
int |
numTotalConnections()
How many actual socket connections do we have, including currently disconnected clients.
|
private void |
onFailure(java.lang.Throwable cause) |
private void |
retry() |
<T> java.util.concurrent.CompletionStage<T> |
send(Request<T> request) |
void |
shutdown()
Shut down the client.
|
static java.util.concurrent.ScheduledExecutorService |
singletonExecutor() |
java.util.stream.Stream<AddressAndClient> |
streamNodes()
Intended for internal usage.
|
java.lang.String |
toString() |
notifyConnectionChange, numListeners, registerForConnectionChanges, unregisterForConnectionChangesclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAllNodesawaitConnected, awaitDisconnected, awaitFullyConnected, awaitFullyDisconnected, awaitFuture, connectFuture, disconnectFuture, fullyConnectedFuture, fullyDisconnectFutureprivate static final java.util.concurrent.ScheduledExecutorService SCHEDULED_EXECUTOR_SERVICE
private static final org.slf4j.Logger log
private final BackoffFunction backoffFunction
private final java.util.concurrent.ScheduledExecutorService scheduledExecutorService
private final Connector connector
private final HostAndPort address
private final ReconnectionListener reconnectionListener
private volatile RawMemcacheClient client
private volatile int reconnectCount
private volatile boolean stayConnected
private volatile java.lang.Throwable connectionFailure
public ReconnectingClient(BackoffFunction backoffFunction, java.util.concurrent.ScheduledExecutorService scheduledExecutorService, HostAndPort address, ReconnectionListener reconnectionListener, int outstandingRequestLimit, int eventLoopThreadFlushMaxBatchSize, boolean binary, Authenticator authenticator, java.util.concurrent.Executor executor, long connectionTimeoutMillis, java.nio.charset.Charset charset, Metrics metrics, int maxSetLength, io.netty.channel.EventLoopGroup eventLoopGroup, java.lang.Class<? extends io.netty.channel.Channel> channelClass)
public ReconnectingClient(BackoffFunction backoffFunction, java.util.concurrent.ScheduledExecutorService scheduledExecutorService, HostAndPort address, int outstandingRequestLimit, int eventLoopThreadFlushMaxBatchSize, boolean binary, Authenticator authenticator, java.util.concurrent.Executor executor, long connectionTimeoutMillis, java.nio.charset.Charset charset, Metrics metrics, int maxSetLength, io.netty.channel.EventLoopGroup eventLoopGroup, java.lang.Class<? extends io.netty.channel.Channel> channelClass)
private ReconnectingClient(BackoffFunction backoffFunction, java.util.concurrent.ScheduledExecutorService scheduledExecutorService, Connector connector, Authenticator authenticator, HostAndPort address, ReconnectionListener reconnectionListener)
ReconnectingClient(BackoffFunction backoffFunction, java.util.concurrent.ScheduledExecutorService scheduledExecutorService, Connector connector, HostAndPort address, ReconnectionListener reconnectionListener)
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()
RawMemcacheClientpublic int numPendingRequests()
public java.util.stream.Stream<AddressAndClient> streamNodes()
RawMemcacheClientRawMemcacheClient.getAllNodes() instead.private void retry()
private void onFailure(java.lang.Throwable cause)
public static java.util.concurrent.ScheduledExecutorService singletonExecutor()
public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2023 Spotify AB. All Rights Reserved.