K
- Key type.V
- Value type.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.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 |
Constructor and Description |
---|
StatefulRedisConnectionImpl(RedisChannelWriter writer,
PushHandler pushHandler,
RedisCodec<K,V> codec,
Duration timeout)
Initialize a new connection.
|
activated, addListener, close, closeAsync, deactivated, flushCommands, getChannelWriter, getOptions, getResources, getTimeout, isClosed, isOpen, registerCloseables, reset, setAutoFlushCommands, setOptions, setTimeout, syncHandler
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, closeAsync, flushCommands, getOptions, getResources, getTimeout, isOpen, reset, setAutoFlushCommands, setTimeout
protected 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 writer, PushHandler pushHandler, RedisCodec<K,V> codec, Duration timeout)
writer
- the channel writer.pushHandler
- the handler for push notifications.codec
- Codec used to encode/decode keys and values.timeout
- Maximum time to wait for a response.public RedisCodec<K,V> getCodec()
public RedisAsyncCommands<K,V> async()
StatefulRedisConnection
RedisAsyncCommands
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()
StatefulRedisConnection
RedisReactiveCommands
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()
StatefulRedisConnection
RedisCommands
API for the current connection. Does not create a new connection.sync
in interface StatefulRedisConnection<K,V>
public void addListener(PushListener listener)
addListener
in interface StatefulRedisConnection<K,V>
listener
- Listener.public void removeListener(PushListener listener)
removeListener
in interface StatefulRedisConnection<K,V>
listener
- Listener.public boolean isMulti()
isMulti
in interface StatefulRedisConnection<K,V>
public <T> RedisCommand<K,V,T> dispatch(RedisCommand<K,V,T> command)
StatefulConnection
dispatch
in interface StatefulConnection<K,V>
dispatch
in class RedisChannelHandler<K,V>
T
- result typecommand
- the Redis command.public Collection<RedisCommand<K,V,?>> dispatch(Collection<? extends RedisCommand<K,V,?>> commands)
StatefulConnection
dispatch
in interface StatefulConnection<K,V>
dispatch
in class RedisChannelHandler<K,V>
commands
- the Redis commands.protected <T> RedisCommand<K,V,T> preProcessCommand(RedisCommand<K,V,T> command)
@Deprecated public void setClientName(String clientName)
RedisServerAsyncCommands.clientSetname(Object)
.clientName
- public ConnectionState getConnectionState()
Copyright © 2022 lettuce.io. All rights reserved.