Class EmbeddedChannel
- java.lang.Object
-
- io.netty.util.DefaultAttributeMap
-
- io.netty.channel.AbstractChannel
-
- io.netty.channel.embedded.EmbeddedChannel
-
- All Implemented Interfaces:
Channel
,ChannelOutboundInvoker
,AttributeMap
,java.lang.Comparable<Channel>
public class EmbeddedChannel extends AbstractChannel
Base class forChannel
implementations that are used in an embedded fashion.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
EmbeddedChannel.EmbeddedChannelPipeline
private class
EmbeddedChannel.EmbeddedUnsafe
private static class
EmbeddedChannel.State
-
Nested classes/interfaces inherited from class io.netty.channel.AbstractChannel
AbstractChannel.AbstractUnsafe
-
Nested classes/interfaces inherited from interface io.netty.channel.Channel
Channel.Unsafe
-
-
Field Summary
Fields Modifier and Type Field Description private ChannelConfig
config
private static ChannelHandler[]
EMPTY_HANDLERS
private java.util.Queue<java.lang.Object>
inboundMessages
private java.lang.Throwable
lastException
private static java.net.SocketAddress
LOCAL_ADDRESS
private static InternalLogger
logger
private EmbeddedEventLoop
loop
private ChannelMetadata
metadata
private static ChannelMetadata
METADATA_DISCONNECT
private static ChannelMetadata
METADATA_NO_DISCONNECT
private java.util.Queue<java.lang.Object>
outboundMessages
private ChannelFutureListener
recordExceptionListener
private static java.net.SocketAddress
REMOTE_ADDRESS
private EmbeddedChannel.State
state
-
Constructor Summary
Constructors Constructor Description EmbeddedChannel()
Create a new instance with anEmbeddedChannelId
and an empty pipeline.EmbeddedChannel(boolean register, boolean hasDisconnect, ChannelHandler... handlers)
Create a new instance with the pipeline initialized with the specified handlers.EmbeddedChannel(boolean hasDisconnect, ChannelHandler... handlers)
Create a new instance with the pipeline initialized with the specified handlers.EmbeddedChannel(ChannelHandler... handlers)
Create a new instance with the pipeline initialized with the specified handlers.EmbeddedChannel(ChannelId channelId)
Create a new instance with the specified ID and an empty pipeline.EmbeddedChannel(ChannelId channelId, boolean register, boolean hasDisconnect, ChannelHandler... handlers)
Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.EmbeddedChannel(ChannelId channelId, boolean hasDisconnect, ChannelConfig config, ChannelHandler... handlers)
Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.EmbeddedChannel(ChannelId channelId, boolean hasDisconnect, ChannelHandler... handlers)
Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.EmbeddedChannel(ChannelId channelId, ChannelHandler... handlers)
Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.EmbeddedChannel(Channel parent, ChannelId channelId, boolean register, boolean hasDisconnect, ChannelHandler... handlers)
Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
advanceTimeBy(long duration, java.util.concurrent.TimeUnit unit)
Advance the clock of the event loop of this channel by the given duration.void
checkException()
Check if there was anyThrowable
received and if so rethrow it.private ChannelFuture
checkException(ChannelPromise promise)
Checks for the presence of anException
.private boolean
checkOpen(boolean recordException)
ChannelFuture
close()
Request to close theChannel
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.ChannelFuture
close(ChannelPromise promise)
Request to close theChannel
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.ChannelConfig
config()
Returns the configuration of this channel.ChannelFuture
disconnect()
Request to disconnect from the remote peer and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.ChannelFuture
disconnect(ChannelPromise promise)
Request to disconnect from the remote peer and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.protected void
doBeginRead()
Schedule a read operation.protected void
doBind(java.net.SocketAddress localAddress)
Bind theChannel
to theSocketAddress
protected void
doClose()
Close theChannel
protected void
doDisconnect()
Disconnect thisChannel
from its remote peerprotected void
doRegister()
protected void
doWrite(ChannelOutboundBuffer in)
Flush the content of the given buffer to the remote peer.private EmbeddedEventLoop
embeddedEventLoop()
protected void
ensureOpen()
Ensure theChannel
is open and if not throw an exception.boolean
finish()
Mark thisChannel
as finished.private boolean
finish(boolean releaseAll)
Mark thisChannel
as finished.boolean
finishAndReleaseAll()
Mark thisChannel
as finished and release all pending message in the inbound and outbound buffer.private void
finishPendingTasks(boolean cancel)
EmbeddedChannel
flushInbound()
Flushes the inbound of thisChannel
.private ChannelFuture
flushInbound(boolean recordException, ChannelPromise promise)
EmbeddedChannel
flushOutbound()
Flushes the outbound of thisChannel
.private void
flushOutbound0()
void
freezeTime()
Freeze the clock of this channel's event loop.protected void
handleInboundMessage(java.lang.Object msg)
Called for each inbound message.protected void
handleOutboundMessage(java.lang.Object msg)
Called for each outbound message.boolean
hasPendingTasks()
Check whether this channel has any pending tasks that would be executed by a call torunPendingTasks()
.java.util.Queue<java.lang.Object>
inboundMessages()
boolean
isActive()
Returntrue
if theChannel
is active and so connected.protected boolean
isCompatible(EventLoop loop)
Returntrue
if the givenEventLoop
is compatible with this instance.private static boolean
isNotEmpty(java.util.Queue<java.lang.Object> queue)
boolean
isOpen()
Returnstrue
if theChannel
is open and may get active laterjava.util.Queue<java.lang.Object>
lastInboundBuffer()
Deprecated.java.util.Queue<java.lang.Object>
lastOutboundBuffer()
Deprecated.protected java.net.SocketAddress
localAddress0()
Returns theSocketAddress
which is bound locally.ChannelMetadata
metadata()
private static ChannelMetadata
metadata(boolean hasDisconnect)
protected DefaultChannelPipeline
newChannelPipeline()
Returns a newDefaultChannelPipeline
instance.protected AbstractChannel.AbstractUnsafe
newUnsafe()
Create a newAbstractChannel.AbstractUnsafe
instance which will be used for the life-time of theChannel
java.util.Queue<java.lang.Object>
outboundMessages()
private static java.lang.Object
poll(java.util.Queue<java.lang.Object> queue)
<T> T
readInbound()
Return received data from thisChannel
<T> T
readOutbound()
Read data from the outbound.private void
recordException(ChannelFuture future)
private void
recordException(java.lang.Throwable cause)
void
register()
Register thisChannel
on itsEventLoop
.private static boolean
releaseAll(java.util.Queue<java.lang.Object> queue)
boolean
releaseInbound()
Release all buffered inbound messages and returntrue
if any were in the inbound buffer,false
otherwise.boolean
releaseOutbound()
Release all buffered outbound messages and returntrue
if any were in the outbound buffer,false
otherwise.protected java.net.SocketAddress
remoteAddress0()
Return theSocketAddress
which theChannel
is connected to.void
runPendingTasks()
long
runScheduledPendingTasks()
private void
setup(boolean register, ChannelHandler... handlers)
void
unfreezeTime()
Unfreeze an event loop that wasfrozen
.Channel.Unsafe
unsafe()
Returns an internal-use-only object that provides unsafe operations.boolean
writeInbound(java.lang.Object... msgs)
Write messages to the inbound of thisChannel
.ChannelFuture
writeOneInbound(java.lang.Object msg)
Writes one message to the inbound of thisChannel
and does not flush it.ChannelFuture
writeOneInbound(java.lang.Object msg, ChannelPromise promise)
Writes one message to the inbound of thisChannel
and does not flush it.ChannelFuture
writeOneOutbound(java.lang.Object msg)
Writes one message to the outbound of thisChannel
and does not flush it.ChannelFuture
writeOneOutbound(java.lang.Object msg, ChannelPromise promise)
Writes one message to the outbound of thisChannel
and does not flush it.boolean
writeOutbound(java.lang.Object... msgs)
Write messages to the outbound of thisChannel
.-
Methods inherited from class io.netty.channel.AbstractChannel
alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, doDeregister, doShutdownOutput, equals, eventLoop, filterOutboundMessage, flush, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, isWritable, localAddress, maxMessagesPerWrite, newFailedFuture, newId, newProgressivePromise, newPromise, newSucceededFuture, parent, pipeline, read, remoteAddress, toString, validateFileRegion, voidPromise, write, write, writeAndFlush, writeAndFlush
-
Methods inherited from class io.netty.util.DefaultAttributeMap
attr, hasAttr
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty.util.AttributeMap
attr, hasAttr
-
-
-
-
Field Detail
-
LOCAL_ADDRESS
private static final java.net.SocketAddress LOCAL_ADDRESS
-
REMOTE_ADDRESS
private static final java.net.SocketAddress REMOTE_ADDRESS
-
EMPTY_HANDLERS
private static final ChannelHandler[] EMPTY_HANDLERS
-
logger
private static final InternalLogger logger
-
METADATA_NO_DISCONNECT
private static final ChannelMetadata METADATA_NO_DISCONNECT
-
METADATA_DISCONNECT
private static final ChannelMetadata METADATA_DISCONNECT
-
loop
private final EmbeddedEventLoop loop
-
recordExceptionListener
private final ChannelFutureListener recordExceptionListener
-
metadata
private final ChannelMetadata metadata
-
config
private final ChannelConfig config
-
inboundMessages
private java.util.Queue<java.lang.Object> inboundMessages
-
outboundMessages
private java.util.Queue<java.lang.Object> outboundMessages
-
lastException
private java.lang.Throwable lastException
-
state
private EmbeddedChannel.State state
-
-
Constructor Detail
-
EmbeddedChannel
public EmbeddedChannel()
Create a new instance with anEmbeddedChannelId
and an empty pipeline.
-
EmbeddedChannel
public EmbeddedChannel(ChannelId channelId)
Create a new instance with the specified ID and an empty pipeline.- Parameters:
channelId
- theChannelId
that will be used to identify this channel
-
EmbeddedChannel
public EmbeddedChannel(ChannelHandler... handlers)
Create a new instance with the pipeline initialized with the specified handlers.- Parameters:
handlers
- theChannelHandler
s which will be add in theChannelPipeline
-
EmbeddedChannel
public EmbeddedChannel(boolean hasDisconnect, ChannelHandler... handlers)
Create a new instance with the pipeline initialized with the specified handlers.- Parameters:
hasDisconnect
-false
if thisChannel
will delegatedisconnect()
toclose()
,true
otherwise.handlers
- theChannelHandler
s which will be added to theChannelPipeline
-
EmbeddedChannel
public EmbeddedChannel(boolean register, boolean hasDisconnect, ChannelHandler... handlers)
Create a new instance with the pipeline initialized with the specified handlers.- Parameters:
register
-true
if thisChannel
is registered to theEventLoop
in the constructor. Iffalse
the user will need to callregister()
.hasDisconnect
-false
if thisChannel
will delegatedisconnect()
toclose()
,true
otherwise.handlers
- theChannelHandler
s which will be added to theChannelPipeline
-
EmbeddedChannel
public EmbeddedChannel(ChannelId channelId, ChannelHandler... handlers)
Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.- Parameters:
channelId
- theChannelId
that will be used to identify this channelhandlers
- theChannelHandler
s which will be added to theChannelPipeline
-
EmbeddedChannel
public EmbeddedChannel(ChannelId channelId, boolean hasDisconnect, ChannelHandler... handlers)
Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.- Parameters:
channelId
- theChannelId
that will be used to identify this channelhasDisconnect
-false
if thisChannel
will delegatedisconnect()
toclose()
,true
otherwise.handlers
- theChannelHandler
s which will be added to theChannelPipeline
-
EmbeddedChannel
public EmbeddedChannel(ChannelId channelId, boolean register, boolean hasDisconnect, ChannelHandler... handlers)
Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.- Parameters:
channelId
- theChannelId
that will be used to identify this channelregister
-true
if thisChannel
is registered to theEventLoop
in the constructor. Iffalse
the user will need to callregister()
.hasDisconnect
-false
if thisChannel
will delegatedisconnect()
toclose()
,true
otherwise.handlers
- theChannelHandler
s which will be added to theChannelPipeline
-
EmbeddedChannel
public EmbeddedChannel(Channel parent, ChannelId channelId, boolean register, boolean hasDisconnect, ChannelHandler... handlers)
Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.- Parameters:
parent
- the parentChannel
of thisEmbeddedChannel
.channelId
- theChannelId
that will be used to identify this channelregister
-true
if thisChannel
is registered to theEventLoop
in the constructor. Iffalse
the user will need to callregister()
.hasDisconnect
-false
if thisChannel
will delegatedisconnect()
toclose()
,true
otherwise.handlers
- theChannelHandler
s which will be added to theChannelPipeline
-
EmbeddedChannel
public EmbeddedChannel(ChannelId channelId, boolean hasDisconnect, ChannelConfig config, ChannelHandler... handlers)
Create a new instance with the channel ID set to the given ID and the pipeline initialized with the specified handlers.- Parameters:
channelId
- theChannelId
that will be used to identify this channelhasDisconnect
-false
if thisChannel
will delegatedisconnect()
toclose()
,true
otherwise.config
- theChannelConfig
which will be returned byconfig()
.handlers
- theChannelHandler
s which will be added to theChannelPipeline
-
-
Method Detail
-
metadata
private static ChannelMetadata metadata(boolean hasDisconnect)
-
setup
private void setup(boolean register, ChannelHandler... handlers)
-
register
public void register() throws java.lang.Exception
Register thisChannel
on itsEventLoop
.- Throws:
java.lang.Exception
-
newChannelPipeline
protected final DefaultChannelPipeline newChannelPipeline()
Description copied from class:AbstractChannel
Returns a newDefaultChannelPipeline
instance.- Overrides:
newChannelPipeline
in classAbstractChannel
-
metadata
public ChannelMetadata metadata()
Description copied from interface:Channel
-
config
public ChannelConfig config()
Description copied from interface:Channel
Returns the configuration of this channel.
-
isOpen
public boolean isOpen()
Description copied from interface:Channel
Returnstrue
if theChannel
is open and may get active later
-
isActive
public boolean isActive()
Description copied from interface:Channel
Returntrue
if theChannel
is active and so connected.
-
inboundMessages
public java.util.Queue<java.lang.Object> inboundMessages()
-
lastInboundBuffer
@Deprecated public java.util.Queue<java.lang.Object> lastInboundBuffer()
Deprecated.
-
outboundMessages
public java.util.Queue<java.lang.Object> outboundMessages()
-
lastOutboundBuffer
@Deprecated public java.util.Queue<java.lang.Object> lastOutboundBuffer()
Deprecated.
-
readInbound
public <T> T readInbound()
Return received data from thisChannel
-
readOutbound
public <T> T readOutbound()
Read data from the outbound. This may returnnull
if nothing is readable.
-
writeInbound
public boolean writeInbound(java.lang.Object... msgs)
Write messages to the inbound of thisChannel
.- Parameters:
msgs
- the messages to be written- Returns:
true
if the write operation did add something to the inbound buffer
-
writeOneInbound
public ChannelFuture writeOneInbound(java.lang.Object msg)
Writes one message to the inbound of thisChannel
and does not flush it. This method is conceptually equivalent toAbstractChannel.write(Object)
.- See Also:
writeOneOutbound(Object)
-
writeOneInbound
public ChannelFuture writeOneInbound(java.lang.Object msg, ChannelPromise promise)
Writes one message to the inbound of thisChannel
and does not flush it. This method is conceptually equivalent toAbstractChannel.write(Object, ChannelPromise)
.- See Also:
writeOneOutbound(Object, ChannelPromise)
-
flushInbound
public EmbeddedChannel flushInbound()
Flushes the inbound of thisChannel
. This method is conceptually equivalent toAbstractChannel.flush()
.- See Also:
flushOutbound()
-
flushInbound
private ChannelFuture flushInbound(boolean recordException, ChannelPromise promise)
-
writeOutbound
public boolean writeOutbound(java.lang.Object... msgs)
Write messages to the outbound of thisChannel
.- Parameters:
msgs
- the messages to be written- Returns:
- bufferReadable returns
true
if the write operation did add something to the outbound buffer
-
writeOneOutbound
public ChannelFuture writeOneOutbound(java.lang.Object msg)
Writes one message to the outbound of thisChannel
and does not flush it. This method is conceptually equivalent toAbstractChannel.write(Object)
.- See Also:
writeOneInbound(Object)
-
writeOneOutbound
public ChannelFuture writeOneOutbound(java.lang.Object msg, ChannelPromise promise)
Writes one message to the outbound of thisChannel
and does not flush it. This method is conceptually equivalent toAbstractChannel.write(Object, ChannelPromise)
.- See Also:
writeOneInbound(Object, ChannelPromise)
-
flushOutbound
public EmbeddedChannel flushOutbound()
Flushes the outbound of thisChannel
. This method is conceptually equivalent toAbstractChannel.flush()
.- See Also:
flushInbound()
-
flushOutbound0
private void flushOutbound0()
-
finish
public boolean finish()
Mark thisChannel
as finished. Any further try to write data to it will fail.- Returns:
- bufferReadable returns
true
if any of the used buffers has something left to read
-
finishAndReleaseAll
public boolean finishAndReleaseAll()
Mark thisChannel
as finished and release all pending message in the inbound and outbound buffer. Any further try to write data to it will fail.- Returns:
- bufferReadable returns
true
if any of the used buffers has something left to read
-
finish
private boolean finish(boolean releaseAll)
Mark thisChannel
as finished. Any further try to write data to it will fail.- Parameters:
releaseAll
- iftrue
all pending message in the inbound and outbound buffer are released.- Returns:
- bufferReadable returns
true
if any of the used buffers has something left to read
-
releaseInbound
public boolean releaseInbound()
Release all buffered inbound messages and returntrue
if any were in the inbound buffer,false
otherwise.
-
releaseOutbound
public boolean releaseOutbound()
Release all buffered outbound messages and returntrue
if any were in the outbound buffer,false
otherwise.
-
releaseAll
private static boolean releaseAll(java.util.Queue<java.lang.Object> queue)
-
finishPendingTasks
private void finishPendingTasks(boolean cancel)
-
close
public final ChannelFuture close()
Description copied from interface:ChannelOutboundInvoker
Request to close theChannel
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error. After it is closed it is not possible to reuse it again.This will result in having the
ChannelOutboundHandler.close(ChannelHandlerContext, ChannelPromise)
method called of the nextChannelOutboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
close
in interfaceChannelOutboundInvoker
- Overrides:
close
in classAbstractChannel
-
disconnect
public final ChannelFuture disconnect()
Description copied from interface:ChannelOutboundInvoker
Request to disconnect from the remote peer and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelOutboundHandler.disconnect(ChannelHandlerContext, ChannelPromise)
method called of the nextChannelOutboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
disconnect
in interfaceChannelOutboundInvoker
- Overrides:
disconnect
in classAbstractChannel
-
close
public final ChannelFuture close(ChannelPromise promise)
Description copied from interface:ChannelOutboundInvoker
Request to close theChannel
and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error. After it is closed it is not possible to reuse it again. The givenChannelPromise
will be notified.This will result in having the
ChannelOutboundHandler.close(ChannelHandlerContext, ChannelPromise)
method called of the nextChannelOutboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
close
in interfaceChannelOutboundInvoker
- Overrides:
close
in classAbstractChannel
-
disconnect
public final ChannelFuture disconnect(ChannelPromise promise)
Description copied from interface:ChannelOutboundInvoker
Request to disconnect from the remote peer and notify theChannelFuture
once the operation completes, either because the operation was successful or because of an error. The givenChannelPromise
will be notified.This will result in having the
ChannelOutboundHandler.disconnect(ChannelHandlerContext, ChannelPromise)
method called of the nextChannelOutboundHandler
contained in theChannelPipeline
of theChannel
.- Specified by:
disconnect
in interfaceChannelOutboundInvoker
- Overrides:
disconnect
in classAbstractChannel
-
isNotEmpty
private static boolean isNotEmpty(java.util.Queue<java.lang.Object> queue)
-
poll
private static java.lang.Object poll(java.util.Queue<java.lang.Object> queue)
-
runPendingTasks
public void runPendingTasks()
-
hasPendingTasks
public boolean hasPendingTasks()
Check whether this channel has any pending tasks that would be executed by a call torunPendingTasks()
. This includes normal tasks, and scheduled tasks where the deadline has expired. If this method returnsfalse
, a call torunPendingTasks()
would do nothing.- Returns:
true
if there are any pending tasks,false
otherwise.
-
runScheduledPendingTasks
public long runScheduledPendingTasks()
-
recordException
private void recordException(ChannelFuture future)
-
recordException
private void recordException(java.lang.Throwable cause)
-
advanceTimeBy
public void advanceTimeBy(long duration, java.util.concurrent.TimeUnit unit)
Advance the clock of the event loop of this channel by the given duration. Any scheduled tasks will execute sooner by the given time (butrunScheduledPendingTasks()
still needs to be called).
-
freezeTime
public void freezeTime()
Freeze the clock of this channel's event loop. Any scheduled tasks that are not already due will not run on futurerunScheduledPendingTasks()
calls. While the event loop is frozen, it is still possible toadvance time
manually so that scheduled tasks execute.
-
unfreezeTime
public void unfreezeTime()
Unfreeze an event loop that wasfrozen
. Time will continue at the point wherefreezeTime()
stopped it: if a task was scheduled ten minutes in the future andfreezeTime()
was called, it will run ten minutes after this method is called again (assuming noadvanceTimeBy(long, TimeUnit)
calls, and assuming pending scheduled tasks are run at that time usingrunScheduledPendingTasks()
).
-
checkException
private ChannelFuture checkException(ChannelPromise promise)
Checks for the presence of anException
.
-
checkException
public void checkException()
Check if there was anyThrowable
received and if so rethrow it.
-
checkOpen
private boolean checkOpen(boolean recordException)
-
embeddedEventLoop
private EmbeddedEventLoop embeddedEventLoop()
-
ensureOpen
protected final void ensureOpen()
Ensure theChannel
is open and if not throw an exception.
-
isCompatible
protected boolean isCompatible(EventLoop loop)
Description copied from class:AbstractChannel
Returntrue
if the givenEventLoop
is compatible with this instance.- Specified by:
isCompatible
in classAbstractChannel
-
localAddress0
protected java.net.SocketAddress localAddress0()
Description copied from class:AbstractChannel
Returns theSocketAddress
which is bound locally.- Specified by:
localAddress0
in classAbstractChannel
-
remoteAddress0
protected java.net.SocketAddress remoteAddress0()
Description copied from class:AbstractChannel
Return theSocketAddress
which theChannel
is connected to.- Specified by:
remoteAddress0
in classAbstractChannel
-
doRegister
protected void doRegister() throws java.lang.Exception
Description copied from class:AbstractChannel
Is called after theChannel
is registered with itsEventLoop
as part of the register process. Sub-classes may override this method- Overrides:
doRegister
in classAbstractChannel
- Throws:
java.lang.Exception
-
doBind
protected void doBind(java.net.SocketAddress localAddress) throws java.lang.Exception
Description copied from class:AbstractChannel
Bind theChannel
to theSocketAddress
- Specified by:
doBind
in classAbstractChannel
- Throws:
java.lang.Exception
-
doDisconnect
protected void doDisconnect() throws java.lang.Exception
Description copied from class:AbstractChannel
Disconnect thisChannel
from its remote peer- Specified by:
doDisconnect
in classAbstractChannel
- Throws:
java.lang.Exception
-
doClose
protected void doClose() throws java.lang.Exception
Description copied from class:AbstractChannel
Close theChannel
- Specified by:
doClose
in classAbstractChannel
- Throws:
java.lang.Exception
-
doBeginRead
protected void doBeginRead() throws java.lang.Exception
Description copied from class:AbstractChannel
Schedule a read operation.- Specified by:
doBeginRead
in classAbstractChannel
- Throws:
java.lang.Exception
-
newUnsafe
protected AbstractChannel.AbstractUnsafe newUnsafe()
Description copied from class:AbstractChannel
Create a newAbstractChannel.AbstractUnsafe
instance which will be used for the life-time of theChannel
- Specified by:
newUnsafe
in classAbstractChannel
-
unsafe
public Channel.Unsafe unsafe()
Description copied from interface:Channel
Returns an internal-use-only object that provides unsafe operations.- Specified by:
unsafe
in interfaceChannel
- Overrides:
unsafe
in classAbstractChannel
-
doWrite
protected void doWrite(ChannelOutboundBuffer in) throws java.lang.Exception
Description copied from class:AbstractChannel
Flush the content of the given buffer to the remote peer.- Specified by:
doWrite
in classAbstractChannel
- Throws:
java.lang.Exception
-
handleOutboundMessage
protected void handleOutboundMessage(java.lang.Object msg)
Called for each outbound message.- See Also:
doWrite(ChannelOutboundBuffer)
-
handleInboundMessage
protected void handleInboundMessage(java.lang.Object msg)
Called for each inbound message.
-
-