K - Key type.V - Value type.@ChannelHandler.Sharable public class StatefulRedisConnectionImpl<K,V> extends RedisChannelHandler<K,V> implements StatefulRedisConnection<K,V>
StatefulRedisConnectionImpl
A ConnectionWatchdog monitors each connection and reconnects automatically until RedisChannelHandler.close() is called. All
pending commands will be (re)sent after successful reconnection.ChannelHandler.Sharable| Modifier and Type | Field and Description |
|---|---|
protected RedisAsyncCommandsImpl<K,V> |
async |
protected RedisCodec<K,V> |
codec |
protected MultiOutput<K,V> |
multi |
protected RedisReactiveCommandsImpl<K,V> |
reactive |
protected RedisCommands<K,V> |
sync |
timeout, unit| Constructor and Description |
|---|
StatefulRedisConnectionImpl(RedisChannelWriter<K,V> writer,
RedisCodec<K,V> codec,
long timeout,
TimeUnit unit)
Initialize a new connection.
|
| Modifier and Type | Method and Description |
|---|---|
void |
activated()
Notification when the connection becomes active (connected).
|
RedisAsyncCommands<K,V> |
async()
Returns the
RedisAsyncCommands API for the current connection. |
<T,C extends RedisCommand<K,V,T>> |
dispatch(C command)
Dispatch a command.
|
boolean |
isMulti() |
protected RedisAsyncCommandsImpl<K,V> |
newRedisAsyncCommandsImpl()
Create a new instance of
RedisAsyncCommandsImpl. |
protected RedisReactiveCommandsImpl<K,V> |
newRedisReactiveCommandsImpl()
Create a new instance of
RedisReactiveCommandsImpl. |
protected RedisCommands<K,V> |
newRedisSyncCommandsImpl()
Create a new instance of
RedisCommands. |
RedisReactiveCommands<K,V> |
reactive()
Returns the
RedisReactiveCommands API for the current connection. |
void |
setClientName(String clientName) |
RedisCommands<K,V> |
sync()
Returns the
RedisCommands API for the current connection. |
addListener, channelRead, channelRead, channelRegistered, close, deactivated, flushCommands, getChannelWriter, getOptions, getTimeout, getTimeoutUnit, isClosed, isOpen, registerCloseables, reset, setAutoFlushCommands, setOptions, setTimeout, syncHandlerchannelActive, channelInactive, channelReadComplete, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredensureNotSharable, handlerAdded, handlerRemoved, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, flushCommands, getOptions, getTimeout, getTimeoutUnit, isOpen, reset, setAutoFlushCommands, setTimeouthandlerAdded, handlerRemovedprotected final RedisCodec<K,V> codec
protected final RedisCommands<K,V> sync
protected final RedisAsyncCommandsImpl<K,V> async
protected final RedisReactiveCommandsImpl<K,V> reactive
protected MultiOutput<K,V> multi
public StatefulRedisConnectionImpl(RedisChannelWriter<K,V> writer, RedisCodec<K,V> codec, long timeout, TimeUnit unit)
writer - the channel writercodec - Codec used to encode/decode keys and values.timeout - Maximum time to wait for a response.unit - Unit of time for the timeout.public RedisAsyncCommands<K,V> async()
StatefulRedisConnectionRedisAsyncCommands API for the current connection. Does not create a new connection.async in interface StatefulRedisConnection<K,V>protected RedisCommands<K,V> newRedisSyncCommandsImpl()
RedisCommands. Can be overriden to extend.protected RedisAsyncCommandsImpl<K,V> newRedisAsyncCommandsImpl()
RedisAsyncCommandsImpl. Can be overriden to extend.public RedisReactiveCommands<K,V> reactive()
StatefulRedisConnectionRedisReactiveCommands API for the current connection. Does not create a new connection.reactive in interface StatefulRedisConnection<K,V>protected RedisReactiveCommandsImpl<K,V> newRedisReactiveCommandsImpl()
RedisReactiveCommandsImpl. Can be overriden to extend.public RedisCommands<K,V> sync()
StatefulRedisConnectionRedisCommands API for the current connection. Does not create a new connection.sync in interface StatefulRedisConnection<K,V>public boolean isMulti()
isMulti in interface StatefulRedisConnection<K,V>public void activated()
RedisChannelHandleractivated in class RedisChannelHandler<K,V>public <T,C extends RedisCommand<K,V,T>> C dispatch(C command)
StatefulConnectiondispatch in interface StatefulConnection<K,V>dispatch in class RedisChannelHandler<K,V>T - result typeC - command typecommand - the Redis commandpublic void setClientName(String clientName)
Copyright © 2017 lettuce.io. All rights reserved.