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 classprivate final class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final C(package private) SocketSendBufferPool.SendBuffer(package private) MessageEventThe current writeMessageEvent(package private) final AtomicIntegerKeeps track of the highWaterMark.(package private) booleanBoolean that indicates that write operation is in progress.private InetSocketAddress(package private) InetSocketAddress(package private) final AbstractNioWorkerTheAbstractNioWorker.(package private) final AbstractNioChannel<C>.WriteRequestQueueQueue of writeMessageEvents.(package private) final AtomicIntegerKeeps track of the number of bytes that theAbstractNioChannel<C extends SelectableChannel & WritableByteChannel>.WriteRequestQueuecurrently contains.(package private) final ObjectMonitor object for synchronizing access to theAbstractNioChannel<C extends SelectableChannel & WritableByteChannel>.WriteRequestQueue.(package private) boolean(package private) final RunnableWriteTask that performs write operations.(package private) final AtomicBooleanIndicates if there is aAbstractNioChannel<C extends SelectableChannel & WritableByteChannel>.WriteTaskin the task queue.Fields inherited from interface org.jboss.netty.channel.Channel
OP_NONE, OP_READ, OP_READ_WRITE, OP_WRITE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractNioChannel(Integer id, Channel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, AbstractNioWorker worker, C ch) protectedAbstractNioChannel(Channel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, AbstractNioWorker worker, C ch) -
Method Summary
Modifier and TypeMethodDescriptionabstract NioChannelConfigReturns the configuration of this channel.protected intReturns the local address where this channel is bound to.(package private) abstract InetSocketAddressReturns the remote address where this channel is connected to.(package private) abstract InetSocketAddressReturn theAbstractNioWorkerthat handle the IO of theAbstractNioChannelprotected booleanMarks this channel as closed.protected voidsetInternalInterestOps(int interestOps) Sets theinterestOpsproperty 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, writeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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>.WriteTaskin the task queue. -
writeBufferQueue
final AbstractNioChannel<C extends SelectableChannel & WritableByteChannel>.WriteRequestQueue writeBufferQueueQueue of writeMessageEvents. -
writeBufferSize
Keeps track of the number of bytes that theAbstractNioChannel<C extends SelectableChannel & WritableByteChannel>.WriteRequestQueuecurrently 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 theAbstractNioWorkerthat handle the IO of theAbstractNioChannel- Returns:
- worker
-
getLocalAddress
Description copied from interface:ChannelReturns the local address where this channel is bound to. The returnedSocketAddressis supposed to be down-cast into more concrete type such asInetSocketAddressto retrieve the detailed information.- Returns:
- the local address of this channel.
nullif this channel is not bound.
-
getRemoteAddress
Description copied from interface:ChannelReturns the remote address where this channel is connected to. The returnedSocketAddressis supposed to be down-cast into more concrete type such asInetSocketAddressto retrieve the detailed information.- Returns:
- the remote address of this channel.
nullif 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:ChannelReturns the configuration of this channel. -
getInternalInterestOps
protected int getInternalInterestOps()- Overrides:
getInternalInterestOpsin classAbstractChannel
-
setInternalInterestOps
protected void setInternalInterestOps(int interestOps) Description copied from class:AbstractChannelSets theinterestOpsproperty 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:
setInternalInterestOpsin classAbstractChannel
-
setClosed
protected boolean setClosed()Description copied from class:AbstractChannelMarks 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:
setClosedin classAbstractChannel- Returns:
trueif and only if this channel was not marked as closed yet
-
getLocalSocketAddress
- Throws:
Exception
-
getRemoteSocketAddress
- Throws:
Exception
-