K
- Key type.V
- Value type.public abstract class RedisChannelHandler<K,V> extends ChannelInboundHandlerAdapter implements Closeable
ChannelHandler.Sharable
Modifier and Type | Field and Description |
---|---|
protected long |
timeout |
protected TimeUnit |
unit |
Constructor and Description |
---|
RedisChannelHandler(RedisChannelWriter<K,V> writer,
long timeout,
TimeUnit unit) |
Modifier and Type | Method and Description |
---|---|
void |
activated()
Notification when the connection becomes active (connected).
|
protected void |
addListener(com.lambdaworks.redis.CloseEvents.CloseListener listener) |
void |
channelRead(ChannelHandlerContext ctx,
Object msg) |
void |
channelRead(Object msg)
Invoked on a channel read.
|
void |
channelRegistered(ChannelHandlerContext ctx) |
void |
close()
Close the connection.
|
void |
deactivated()
Notification when the connection becomes inactive (disconnected).
|
protected <T,C extends RedisCommand<K,V,T>> |
dispatch(C cmd) |
void |
flushCommands() |
RedisChannelWriter<K,V> |
getChannelWriter() |
ClientOptions |
getOptions() |
long |
getTimeout() |
TimeUnit |
getTimeoutUnit() |
boolean |
isClosed() |
boolean |
isOpen() |
void |
registerCloseables(Collection<Closeable> registry,
Closeable... closeables)
Register Closeable resources.
|
void |
reset() |
void |
setAutoFlushCommands(boolean autoFlush) |
void |
setOptions(ClientOptions clientOptions) |
void |
setTimeout(long timeout,
TimeUnit unit)
Set the command timeout for this connection.
|
protected <T> T |
syncHandler(Object asyncApi,
Class<?>... interfaces) |
channelActive, channelInactive, channelReadComplete, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerAdded, handlerRemoved
protected long timeout
protected TimeUnit unit
public RedisChannelHandler(RedisChannelWriter<K,V> writer, long timeout, TimeUnit unit)
writer
- the channel writertimeout
- timeout valueunit
- unit of the timeoutpublic void channelRegistered(ChannelHandlerContext ctx) throws Exception
channelRegistered
in interface ChannelInboundHandler
channelRegistered
in class ChannelInboundHandlerAdapter
Exception
public void setTimeout(long timeout, TimeUnit unit)
timeout
- Command timeout.unit
- Unit of time for the timeout.public void close()
close
in interface Closeable
close
in interface AutoCloseable
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
channelRead
in interface ChannelInboundHandler
channelRead
in class ChannelInboundHandlerAdapter
Exception
public void channelRead(Object msg)
msg
- channel messageprotected <T,C extends RedisCommand<K,V,T>> C dispatch(C cmd)
public void registerCloseables(Collection<Closeable> registry, Closeable... closeables)
registry
- registry of closeablescloseables
- closeables to registerprotected void addListener(com.lambdaworks.redis.CloseEvents.CloseListener listener)
public boolean isClosed()
public void activated()
public void deactivated()
public RedisChannelWriter<K,V> getChannelWriter()
public boolean isOpen()
public void reset()
public ClientOptions getOptions()
public void setOptions(ClientOptions clientOptions)
public long getTimeout()
public TimeUnit getTimeoutUnit()
public void setAutoFlushCommands(boolean autoFlush)
public void flushCommands()
Copyright © 2018 lettuce.io. All rights reserved.