S
- the type of the source. E.g. a ByteBuffer or
a Supplier
.D
- the type of the destination. E.g. a ByteBuffer
or a Consumer
.public abstract class ChannelHandler<H extends ChannelHandler,S,D> extends Object
Modifier and Type | Field and Description |
---|---|
protected Channel |
channel
The Channel this ChannelHandler handles.
|
protected D |
dst |
protected S |
src |
Constructor and Description |
---|
ChannelHandler() |
Modifier and Type | Method and Description |
---|---|
D |
dst()
Gets the destination of this ChannelHandler.
|
void |
dst(D dst)
Sets the destination of this ChannelHandler.
|
void |
handlerAdded()
Gets called when this ChannelHandler is added to the pipeline.
|
void |
interceptError(Throwable error)
Intercepts an error that is thrown while processing the inbound or
outbound pipeline.
|
void |
requestClose()
Asks handler to trigger the closing process.
|
H |
setChannel(Channel channel)
Sets the Channel.
|
S |
src()
Gets the source of this ChannelHandler.
|
void |
src(S src)
Sets the source of this ChannelHandler.
|
protected Channel channel
protected S src
protected D dst
public S src()
public void src(S src)
src
- the new source; is allowed to be null.public D dst()
public void dst(D dst)
dst
- the new destination; is allowed to be null.public final H setChannel(Channel channel)
InboundPipeline
.channel
- the Channelpublic void handlerAdded()
public void interceptError(Throwable error) throws Throwable
Throwable
is send to the ChannelErrorHandler
.
However in some cases like with TLS a more informative exception
needs to be thrown. To prevent loosing stacktraces, it is best to
include the original Throwable as cause in the new Throwable.
This method will only be called from the thread owning the pipeline
this handler is part of.
No modifications should be done to the pipeline and no attempts
should be made to 'repair' the channel. When a Throwable is thrown,
it is the end of the channel.error
- the Throwable thrown while processing the pipeline.Throwable
- the new Throwablepublic void requestClose() throws Exception
Exception
Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.