public class DefaultRawMemcacheClient extends AbstractRawMemcacheClient
| Modifier and Type | Class and Description |
|---|---|
private class |
DefaultRawMemcacheClient.ConnectionHandler
Handles a channel connected to the address specified in the constructor.
|
private class |
DefaultRawMemcacheClient.RequestWritePromise |
| Modifier and Type | Field and Description |
|---|---|
private HostAndPort |
address |
private io.netty.channel.Channel |
channel |
private long |
connectionTimeoutMillis |
private static com.google.common.base.Supplier<io.netty.channel.EventLoopGroup> |
DEFAULT_EVENT_LOOP_GROUP |
private int |
DEFAULT_TIMEOUT_POLL_INTERVAL_MILLIS
how often to check if a request timed out, in msec.
|
private java.util.concurrent.atomic.AtomicReference<java.lang.String> |
disconnectReason |
private java.util.concurrent.Executor |
executor |
private BatchFlusher |
flusher |
private static java.util.concurrent.atomic.AtomicInteger |
GLOBAL_CONNECTION_COUNT |
private org.slf4j.Logger |
log |
private int |
maxSetLength |
private Metrics |
metrics |
private int |
outstandingRequestLimit |
private java.util.concurrent.atomic.AtomicInteger |
pendingCounter |
private int |
pendingCounterLimit |
private static java.util.concurrent.ThreadFactory |
THREAD_FACTORY |
| Modifier | Constructor and Description |
|---|---|
private |
DefaultRawMemcacheClient(HostAndPort address,
io.netty.channel.Channel channel,
int outstandingRequestLimit,
int batchSize,
java.util.concurrent.Executor executor,
long connectionTimeoutMillis,
Metrics metrics,
int maxSetLength) |
| Modifier and Type | Method and Description |
|---|---|
static java.util.concurrent.CompletionStage<RawMemcacheClient> |
connect(HostAndPort address,
int outstandingRequestLimit,
int batchSize,
boolean binary,
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 static java.lang.Class<? extends io.netty.channel.Channel> |
defaultChannelClass(io.netty.channel.EventLoopGroup elg) |
java.lang.Throwable |
getConnectionFailure()
Returns the unrecoverable connection failure, if any.
|
(package private) static int |
getGlobalConnectionCount() |
boolean |
isConnected()
Is the client connected to a server?
|
private boolean |
isLostConnection(java.lang.Throwable t) |
int |
numActiveConnections()
How many active socket connections do we have (i.e.
|
private int |
numPendingRequests() |
int |
numTotalConnections()
How many actual socket connections do we have, including currently disconnected clients.
|
private <T> java.util.concurrent.CompletionStage<T> |
onExecutor(java.util.concurrent.CompletionStage<T> future) |
<T> java.util.concurrent.CompletionStage<T> |
send(Request<T> request) |
private void |
setDisconnected(java.lang.String message) |
private void |
setDisconnected(java.lang.Throwable cause) |
void |
shutdown()
Shut down the client.
|
java.lang.String |
toString() |
private boolean |
tryIncrementPending()
Increment the
pendingCounter, saving a volatile read in the fast path by doing the
limit check in the CAS loop. |
notifyConnectionChange, registerForConnectionChanges, unregisterForConnectionChangesclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitawaitConnected, awaitDisconnected, awaitFullyConnected, awaitFullyDisconnected, awaitFuture, connectFuture, disconnectFuture, fullyConnectedFuture, fullyDisconnectFutureprivate static final java.util.concurrent.atomic.AtomicInteger GLOBAL_CONNECTION_COUNT
private final int DEFAULT_TIMEOUT_POLL_INTERVAL_MILLIS
private final org.slf4j.Logger log
private final java.util.concurrent.atomic.AtomicInteger pendingCounter
private final int outstandingRequestLimit
private final io.netty.channel.Channel channel
private final BatchFlusher flusher
private final HostAndPort address
private final java.util.concurrent.Executor executor
private final long connectionTimeoutMillis
private final Metrics metrics
private final int maxSetLength
private final java.util.concurrent.atomic.AtomicReference<java.lang.String> disconnectReason
private static final java.util.concurrent.ThreadFactory THREAD_FACTORY
private static final com.google.common.base.Supplier<io.netty.channel.EventLoopGroup> DEFAULT_EVENT_LOOP_GROUP
private final int pendingCounterLimit
private DefaultRawMemcacheClient(HostAndPort address, io.netty.channel.Channel channel, int outstandingRequestLimit, int batchSize, java.util.concurrent.Executor executor, long connectionTimeoutMillis, Metrics metrics, int maxSetLength)
public static java.util.concurrent.CompletionStage<RawMemcacheClient> connect(HostAndPort address, int outstandingRequestLimit, int batchSize, boolean binary, 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 static java.lang.Class<? extends io.netty.channel.Channel> defaultChannelClass(io.netty.channel.EventLoopGroup elg)
public <T> java.util.concurrent.CompletionStage<T> send(Request<T> request)
private <T> java.util.concurrent.CompletionStage<T> onExecutor(java.util.concurrent.CompletionStage<T> future)
private boolean tryIncrementPending()
pendingCounter, saving a volatile read in the fast path by doing the
limit check in the CAS loop.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 boolean isLostConnection(java.lang.Throwable t)
public java.lang.String toString()
toString in class java.lang.Objectprivate void setDisconnected(java.lang.Throwable cause)
private void setDisconnected(java.lang.String message)
static int getGlobalConnectionCount()
private int numPendingRequests()
Copyright © 2020 Spotify AB. All Rights Reserved.