Class AbstractNioChannel<C extends java.nio.channels.SelectableChannel & java.nio.channels.WritableByteChannel>
- java.lang.Object
-
- org.jboss.netty.channel.AbstractChannel
-
- org.jboss.netty.channel.socket.nio.AbstractNioChannel<C>
-
- Direct Known Subclasses:
NioDatagramChannel,NioSocketChannel
abstract class AbstractNioChannel<C extends java.nio.channels.SelectableChannel & java.nio.channels.WritableByteChannel> extends AbstractChannel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classAbstractNioChannel.WriteRequestQueueprivate classAbstractNioChannel.WriteTask
-
Field Summary
Fields Modifier and Type Field Description (package private) Cchannel(package private) SocketSendBufferPool.SendBuffercurrentWriteBuffer(package private) MessageEventcurrentWriteEventThe current writeMessageEvent(package private) java.util.concurrent.atomic.AtomicIntegerhighWaterMarkCounterKeeps track of the highWaterMark.(package private) booleaninWriteNowLoopBoolean that indicates that write operation is in progress.private java.net.InetSocketAddresslocalAddress(package private) java.net.InetSocketAddressremoteAddress(package private) AbstractNioWorkerworkerTheAbstractNioWorker.(package private) AbstractNioChannel.WriteRequestQueuewriteBufferQueueQueue of writeMessageEvents.(package private) java.util.concurrent.atomic.AtomicIntegerwriteBufferSizeKeeps track of the number of bytes that theAbstractNioChannel.WriteRequestQueuecurrently contains.(package private) java.lang.ObjectwriteLockMonitor object for synchronizing access to theAbstractNioChannel.WriteRequestQueue.(package private) booleanwriteSuspended(package private) java.lang.RunnablewriteTaskWriteTask that performs write operations.(package private) java.util.concurrent.atomic.AtomicBooleanwriteTaskInTaskQueueIndicates if there is aAbstractNioChannel.WriteTaskin the task queue.-
Fields inherited from interface org.jboss.netty.channel.Channel
OP_NONE, OP_READ, OP_READ_WRITE, OP_WRITE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractNioChannel(java.lang.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
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract NioChannelConfiggetConfig()Returns the configuration of this channel.protected intgetInternalInterestOps()java.net.InetSocketAddressgetLocalAddress()Returns the local address where this channel is bound to.(package private) abstract java.net.InetSocketAddressgetLocalSocketAddress()java.net.InetSocketAddressgetRemoteAddress()Returns the remote address where this channel is connected to.(package private) abstract java.net.InetSocketAddressgetRemoteSocketAddress()AbstractNioWorkergetWorker()Return theAbstractNioWorkerthat handle the IO of theAbstractNioChannelprotected booleansetClosed()Marks 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, 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 Detail
-
worker
final AbstractNioWorker worker
TheAbstractNioWorker.
-
writeLock
final java.lang.Object writeLock
Monitor object for synchronizing access to theAbstractNioChannel.WriteRequestQueue.
-
writeTask
final java.lang.Runnable writeTask
WriteTask that performs write operations.
-
writeTaskInTaskQueue
final java.util.concurrent.atomic.AtomicBoolean writeTaskInTaskQueue
Indicates if there is aAbstractNioChannel.WriteTaskin the task queue.
-
writeBufferQueue
final AbstractNioChannel.WriteRequestQueue writeBufferQueue
Queue of writeMessageEvents.
-
writeBufferSize
final java.util.concurrent.atomic.AtomicInteger writeBufferSize
Keeps track of the number of bytes that theAbstractNioChannel.WriteRequestQueuecurrently contains.
-
highWaterMarkCounter
final java.util.concurrent.atomic.AtomicInteger highWaterMarkCounter
Keeps track of the highWaterMark.
-
currentWriteEvent
MessageEvent currentWriteEvent
The current writeMessageEvent
-
currentWriteBuffer
SocketSendBufferPool.SendBuffer currentWriteBuffer
-
inWriteNowLoop
boolean inWriteNowLoop
Boolean that indicates that write operation is in progress.
-
writeSuspended
boolean writeSuspended
-
localAddress
private volatile java.net.InetSocketAddress localAddress
-
remoteAddress
volatile java.net.InetSocketAddress remoteAddress
-
channel
final C extends java.nio.channels.SelectableChannel & java.nio.channels.WritableByteChannel channel
-
-
Constructor Detail
-
AbstractNioChannel
protected AbstractNioChannel(java.lang.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 Detail
-
getWorker
public AbstractNioWorker getWorker()
Return theAbstractNioWorkerthat handle the IO of theAbstractNioChannel- Returns:
- worker
-
getLocalAddress
public java.net.InetSocketAddress 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
public java.net.InetSocketAddress 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
public abstract NioChannelConfig 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
abstract java.net.InetSocketAddress getLocalSocketAddress() throws java.lang.Exception- Throws:
java.lang.Exception
-
getRemoteSocketAddress
abstract java.net.InetSocketAddress getRemoteSocketAddress() throws java.lang.Exception- Throws:
java.lang.Exception
-
-