public abstract class AbstractRedisClient extends Object
Modifier and Type | Field and Description |
---|---|
protected ChannelGroup |
channels |
protected Set<Closeable> |
closeableResources |
protected ConnectionEvents |
connectionEvents |
protected EventLoopGroup |
eventLoopGroup |
protected static io.netty.util.internal.logging.InternalLogger |
logger |
protected long |
timeout |
protected HashedWheelTimer |
timer |
protected TimeUnit |
unit |
Modifier | Constructor and Description |
---|---|
protected |
AbstractRedisClient() |
Modifier and Type | Method and Description |
---|---|
void |
addListener(RedisConnectionStateListener listener)
Add a listener for the RedisConnectionState.
|
protected <K,V,T extends RedisAsyncConnectionImpl<K,V>> |
connectAsyncImpl(CommandHandler<K,V> handler,
T connection,
Supplier<SocketAddress> socketAddressSupplier,
boolean withReconnect) |
protected void |
connectionBuilder(CommandHandler<?,?> handler,
RedisChannelHandler<?,?> connection,
Supplier<SocketAddress> socketAddressSupplier,
boolean withReconnect,
com.lambdaworks.redis.ConnectionBuilder connectionBuilder,
RedisURI redisURI)
Populate connection builder with necessary resources.
|
protected int |
getChannelCount() |
protected int |
getResourceCount() |
protected <K,V,T extends RedisChannelHandler<K,V>> |
initializeChannel(com.lambdaworks.redis.ConnectionBuilder connectionBuilder) |
void |
removeListener(RedisConnectionStateListener listener)
Removes a listener.
|
void |
setDefaultTimeout(long timeout,
TimeUnit unit)
Set the default timeout for
connections created by this client. |
void |
shutdown()
Shutdown this client and close all open connections.
|
void |
shutdown(long quietPeriod,
long timeout,
TimeUnit timeUnit)
Shutdown this client and close all open connections.
|
protected static <K,V> Object |
syncHandler(RedisChannelHandler<K,V> connection,
Class<?>... interfaceClasses) |
protected static final io.netty.util.internal.logging.InternalLogger logger
protected EventLoopGroup eventLoopGroup
protected HashedWheelTimer timer
protected ChannelGroup channels
protected long timeout
protected TimeUnit unit
protected ConnectionEvents connectionEvents
public void setDefaultTimeout(long timeout, TimeUnit unit)
connections
created by this client. The timeout
applies to connection attempts and non-blocking commands.timeout
- Default connection timeout.unit
- Unit of time for the timeout.protected <K,V,T extends RedisAsyncConnectionImpl<K,V>> T connectAsyncImpl(CommandHandler<K,V> handler, T connection, Supplier<SocketAddress> socketAddressSupplier, boolean withReconnect)
protected void connectionBuilder(CommandHandler<?,?> handler, RedisChannelHandler<?,?> connection, Supplier<SocketAddress> socketAddressSupplier, boolean withReconnect, com.lambdaworks.redis.ConnectionBuilder connectionBuilder, RedisURI redisURI)
handler
- instance of a CommandHandler for writing redis commandsconnection
- implementation of a RedisConnectionsocketAddressSupplier
- address supplier for initial connect and re-connectwithReconnect
- true if the connection should auto-reconnectconnectionBuilder
- connection builder to configure the connectionredisURI
- URI of the redis instanceprotected <K,V,T extends RedisChannelHandler<K,V>> T initializeChannel(com.lambdaworks.redis.ConnectionBuilder connectionBuilder)
public void shutdown()
public void shutdown(long quietPeriod, long timeout, TimeUnit timeUnit)
quietPeriod
- the quiet period as described in the documentationtimeout
- the maximum amount of time to wait until the executor is shutdown regardless if a task was submitted
during the quiet periodtimeUnit
- the unit of quietPeriod
and timeout
protected int getResourceCount()
protected int getChannelCount()
protected static <K,V> Object syncHandler(RedisChannelHandler<K,V> connection, Class<?>... interfaceClasses)
public void addListener(RedisConnectionStateListener listener)
listener
- must not be nullpublic void removeListener(RedisConnectionStateListener listener)
listener
- must not be nullCopyright © 2015. All rights reserved.