Class AbstractNioChannel<C extends SelectableChannel & WritableByteChannel>
java.lang.Object
org.jboss.netty.channel.AbstractChannel
org.jboss.netty.channel.socket.nio.AbstractNioChannel<C>
- All Implemented Interfaces:
Comparable<Channel>
,Channel
- Direct Known Subclasses:
NioDatagramChannel
,NioSocketChannel
abstract class AbstractNioChannel<C extends SelectableChannel & WritableByteChannel>
extends AbstractChannel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) final class
private final class
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final C
(package private) SocketSendBufferPool.SendBuffer
(package private) MessageEvent
The current writeMessageEvent
(package private) final AtomicInteger
Keeps track of the highWaterMark.(package private) boolean
Boolean that indicates that write operation is in progress.private InetSocketAddress
(package private) InetSocketAddress
(package private) final AbstractNioWorker
TheAbstractNioWorker
.(package private) final AbstractNioChannel<C>.WriteRequestQueue
Queue of writeMessageEvent
s.(package private) final AtomicInteger
Keeps track of the number of bytes that theAbstractNioChannel<C extends SelectableChannel & WritableByteChannel>.WriteRequestQueue
currently contains.(package private) final Object
Monitor object for synchronizing access to theAbstractNioChannel<C extends SelectableChannel & WritableByteChannel>.WriteRequestQueue
.(package private) boolean
(package private) final Runnable
WriteTask that performs write operations.(package private) final AtomicBoolean
Indicates if there is aAbstractNioChannel<C extends SelectableChannel & WritableByteChannel>.WriteTask
in the task queue.Fields inherited from interface org.jboss.netty.channel.Channel
OP_NONE, OP_READ, OP_READ_WRITE, OP_WRITE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractNioChannel
(Integer id, Channel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, AbstractNioWorker worker, C ch) protected
AbstractNioChannel
(Channel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, AbstractNioWorker worker, C ch) -
Method Summary
Modifier and TypeMethodDescriptionabstract NioChannelConfig
Returns the configuration of this channel.protected int
Returns the local address where this channel is bound to.(package private) abstract InetSocketAddress
Returns the remote address where this channel is connected to.(package private) abstract InetSocketAddress
Return theAbstractNioWorker
that handle the IO of theAbstractNioChannel
protected boolean
Marks this channel as closed.protected void
setInternalInterestOps
(int interestOps) Sets theinterestOps
property of this channel immediately.Methods inherited from class org.jboss.netty.channel.AbstractChannel
bind, close, compareTo, connect, disconnect, equals, getAttachment, getCloseFuture, getFactory, getId, getInterestOps, getParent, getPipeline, getSucceededFuture, getUnsupportedOperationFuture, getUserDefinedWritability, hashCode, isOpen, isReadable, isWritable, setAttachment, setInterestOps, setReadable, setUnwritable, setUserDefinedWritability, setWritable, toString, unbind, write, write
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jboss.netty.channel.Channel
isBound, isConnected
-
Field Details
-
worker
TheAbstractNioWorker
. -
writeLock
Monitor object for synchronizing access to theAbstractNioChannel<C extends SelectableChannel & WritableByteChannel>.WriteRequestQueue
. -
writeTask
WriteTask that performs write operations. -
writeTaskInTaskQueue
Indicates if there is aAbstractNioChannel<C extends SelectableChannel & WritableByteChannel>.WriteTask
in the task queue. -
writeBufferQueue
final AbstractNioChannel<C extends SelectableChannel & WritableByteChannel>.WriteRequestQueue writeBufferQueueQueue of writeMessageEvent
s. -
writeBufferSize
Keeps track of the number of bytes that theAbstractNioChannel<C extends SelectableChannel & WritableByteChannel>.WriteRequestQueue
currently contains. -
highWaterMarkCounter
Keeps track of the highWaterMark. -
currentWriteEvent
MessageEvent currentWriteEventThe current writeMessageEvent
-
currentWriteBuffer
SocketSendBufferPool.SendBuffer currentWriteBuffer -
inWriteNowLoop
boolean inWriteNowLoopBoolean that indicates that write operation is in progress. -
writeSuspended
boolean writeSuspended -
localAddress
-
remoteAddress
-
channel
-
-
Constructor Details
-
AbstractNioChannel
protected AbstractNioChannel(Integer id, Channel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, AbstractNioWorker worker, C ch) -
AbstractNioChannel
protected AbstractNioChannel(Channel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, AbstractNioWorker worker, C ch)
-
-
Method Details
-
getWorker
Return theAbstractNioWorker
that handle the IO of theAbstractNioChannel
- Returns:
- worker
-
getLocalAddress
Description copied from interface:Channel
Returns the local address where this channel is bound to. The returnedSocketAddress
is supposed to be down-cast into more concrete type such asInetSocketAddress
to retrieve the detailed information.- Returns:
- the local address of this channel.
null
if this channel is not bound.
-
getRemoteAddress
Description copied from interface:Channel
Returns the remote address where this channel is connected to. The returnedSocketAddress
is supposed to be down-cast into more concrete type such asInetSocketAddress
to retrieve the detailed information.- Returns:
- the remote address of this channel.
null
if this channel is not connected. If this channel is not connected but it can receive messages from arbitrary remote addresses (e.g.DatagramChannel
, useMessageEvent.getRemoteAddress()
to determine the origination of the received message as this method will returnnull
.
-
getConfig
Description copied from interface:Channel
Returns the configuration of this channel. -
getInternalInterestOps
protected int getInternalInterestOps()- Overrides:
getInternalInterestOps
in classAbstractChannel
-
setInternalInterestOps
protected void setInternalInterestOps(int interestOps) Description copied from class:AbstractChannel
Sets theinterestOps
property of this channel immediately. This method is intended to be called by an internal component - please do not call it unless you know what you are doing.- Overrides:
setInternalInterestOps
in classAbstractChannel
-
setClosed
protected boolean setClosed()Description copied from class:AbstractChannel
Marks this channel as closed. This method is intended to be called by an internal component - please do not call it unless you know what you are doing.- Overrides:
setClosed
in classAbstractChannel
- Returns:
true
if and only if this channel was not marked as closed yet
-
getLocalSocketAddress
- Throws:
Exception
-
getRemoteSocketAddress
- Throws:
Exception
-