public class NioSocketChannel extends AbstractNioChannel<java.nio.channels.SocketChannel> implements SocketChannel
AbstractNioChannel.WriteRequestQueue| Modifier and Type | Field and Description |
|---|---|
private NioSocketChannelConfig |
config |
private static int |
ST_BOUND |
private static int |
ST_CLOSED |
private static int |
ST_CONNECTED |
private static int |
ST_OPEN |
(package private) int |
state |
channel, currentWriteBuffer, currentWriteEvent, highWaterMarkCounter, inWriteNowLoop, remoteAddress, worker, writeBufferQueue, writeBufferSize, writeLock, writeSuspended, writeTask, writeTaskInTaskQueueOP_NONE, OP_READ, OP_READ_WRITE, OP_WRITE| Constructor and Description |
|---|
NioSocketChannel(Channel parent,
ChannelFactory factory,
ChannelPipeline pipeline,
ChannelSink sink,
java.nio.channels.SocketChannel socket,
NioWorker worker) |
| Modifier and Type | Method and Description |
|---|---|
NioSocketChannelConfig |
getConfig()
Returns the configuration of this channel.
|
(package private) java.net.InetSocketAddress |
getLocalSocketAddress() |
(package private) java.net.InetSocketAddress |
getRemoteSocketAddress() |
NioWorker |
getWorker()
Return the
AbstractNioWorker that handle the IO of the
AbstractNioChannel |
boolean |
isBound()
Returns
true if and only if this channel is bound to a
local address. |
boolean |
isConnected()
Returns
true if and only if this channel is connected to a
remote address. |
boolean |
isOpen()
Returns
true if and only if this channel is open. |
(package private) void |
setBound() |
protected boolean |
setClosed()
Marks this channel as closed.
|
(package private) void |
setConnected() |
ChannelFuture |
write(java.lang.Object message,
java.net.SocketAddress remoteAddress)
Sends a message to this channel asynchronously.
|
getInternalInterestOps, getLocalAddress, getRemoteAddress, setInternalInterestOpsbind, close, compareTo, connect, disconnect, equals, getAttachment, getCloseFuture, getFactory, getId, getInterestOps, getParent, getPipeline, getSucceededFuture, getUnsupportedOperationFuture, getUserDefinedWritability, hashCode, isReadable, isWritable, setAttachment, setInterestOps, setReadable, setUnwritable, setUserDefinedWritability, setWritable, toString, unbind, writeclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetLocalAddress, getRemoteAddressbind, close, connect, disconnect, getAttachment, getCloseFuture, getFactory, getId, getInterestOps, getParent, getPipeline, getUserDefinedWritability, isReadable, isWritable, setAttachment, setInterestOps, setReadable, setUserDefinedWritability, unbind, writeprivate static final int ST_OPEN
private static final int ST_BOUND
private static final int ST_CONNECTED
private static final int ST_CLOSED
volatile int state
private final NioSocketChannelConfig config
public NioSocketChannel(Channel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, java.nio.channels.SocketChannel socket, NioWorker worker)
public NioWorker getWorker()
AbstractNioChannelAbstractNioWorker that handle the IO of the
AbstractNioChannelgetWorker in class AbstractNioChannel<java.nio.channels.SocketChannel>public NioSocketChannelConfig getConfig()
ChannelgetConfig in interface ChannelgetConfig in interface SocketChannelgetConfig in class AbstractNioChannel<java.nio.channels.SocketChannel>public boolean isOpen()
Channeltrue if and only if this channel is open.isOpen in interface ChannelisOpen in class AbstractChannelpublic boolean isBound()
Channeltrue if and only if this channel is bound to a
local address.public boolean isConnected()
Channeltrue if and only if this channel is connected to a
remote address.isConnected in interface Channelfinal void setBound()
final void setConnected()
protected boolean setClosed()
AbstractChannelsetClosed in class AbstractNioChannel<java.nio.channels.SocketChannel>true if and only if this channel was not marked as
closed yetjava.net.InetSocketAddress getLocalSocketAddress()
throws java.lang.Exception
getLocalSocketAddress in class AbstractNioChannel<java.nio.channels.SocketChannel>java.lang.Exceptionjava.net.InetSocketAddress getRemoteSocketAddress()
throws java.lang.Exception
getRemoteSocketAddress in class AbstractNioChannel<java.nio.channels.SocketChannel>java.lang.Exceptionpublic ChannelFuture write(java.lang.Object message, java.net.SocketAddress remoteAddress)
ChannelDatagramChannel)
and is not connected yet, you must specify non-null address. Otherwise,
the write request will fail with NotYetConnectedException and
an 'exceptionCaught' event will be triggered.write in interface Channelwrite in class AbstractChannelmessage - the message to writeremoteAddress - where to send the specified message.
This method is identical to Channel.write(Object)
if null is specified here.ChannelFuture which will be notified when the
write request succeeds or fails