public class OioSocketChannel extends OioByteStreamChannel implements SocketChannel
SocketChannel which is using Old-Blocking-IOAbstractChannel.AbstractUnsafeChannel.Unsafe| Modifier and Type | Field and Description |
|---|---|
private OioSocketChannelConfig |
config |
private static InternalLogger |
logger |
private java.net.Socket |
socket |
SO_TIMEOUT| Constructor and Description |
|---|
OioSocketChannel()
Create a new instance with an new
Socket |
OioSocketChannel(Channel parent,
java.net.Socket socket)
Create a new instance from the given
Socket |
OioSocketChannel(java.net.Socket socket)
Create a new instance from the given
Socket |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkInputShutdown() |
(package private) void |
clearReadPending0() |
OioSocketChannelConfig |
config()
Returns the configuration of this channel.
|
protected void |
doBind(java.net.SocketAddress localAddress)
Bind the
Channel to the SocketAddress |
protected void |
doClose()
Close the
Channel |
protected void |
doConnect(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
Connect to the remote peer using the given localAddress if one is specified or
null otherwise. |
protected void |
doDisconnect()
Disconnect this
Channel from its remote peer |
protected int |
doReadBytes(ByteBuf buf)
Read bytes from the underlying Socket.
|
boolean |
isActive()
Return
true if the Channel is active and so connected. |
boolean |
isInputShutdown()
Determine if the input side of this channel is shutdown.
|
boolean |
isOpen()
Returns
true if the Channel is open and may get active later |
boolean |
isOutputShutdown() |
boolean |
isShutdown()
Determine if both the input and output of this channel have been shutdown.
|
java.net.InetSocketAddress |
localAddress()
Returns the local address where this channel is bound to.
|
protected java.net.SocketAddress |
localAddress0()
Returns the
SocketAddress which is bound locally. |
ServerSocketChannel |
parent()
Returns the parent of this channel.
|
java.net.InetSocketAddress |
remoteAddress()
Returns the remote address where this channel is connected to.
|
protected java.net.SocketAddress |
remoteAddress0()
Return the
SocketAddress which the Channel is connected to. |
protected void |
setReadPending(boolean readPending)
Deprecated.
|
ChannelFuture |
shutdown()
Will shutdown the input and output sides of this channel.
|
ChannelFuture |
shutdown(ChannelPromise promise)
Will shutdown the input and output sides of this channel.
|
private void |
shutdown0(ChannelPromise promise) |
ChannelFuture |
shutdownInput()
Shutdown the input side of this channel.
|
ChannelFuture |
shutdownInput(ChannelPromise promise)
Will shutdown the input and notify
ChannelPromise. |
private void |
shutdownInput0(ChannelPromise promise) |
ChannelFuture |
shutdownOutput() |
ChannelFuture |
shutdownOutput(ChannelPromise promise)
Will shutdown the output and notify
ChannelPromise. |
private void |
shutdownOutput0(ChannelPromise promise) |
activate, available, doWriteBytes, doWriteFileRegiondoRead, doWrite, filterOutboundMessage, metadataclearReadPending, doBeginRead, isCompatible, isReadPending, newUnsafealloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, doDeregister, doRegister, equals, eventLoop, flush, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, isWritable, newChannelPipeline, newFailedFuture, newId, newProgressivePromise, newPromise, newSucceededFuture, pipeline, read, toString, unsafe, voidPromise, write, write, writeAndFlush, writeAndFlushattr, hasAttrclone, finalize, getClass, notify, notifyAll, wait, wait, waitalloc, bytesBeforeUnwritable, bytesBeforeWritable, closeFuture, eventLoop, flush, id, isRegistered, isWritable, metadata, pipeline, read, unsafeattr, hasAttrbind, bind, close, close, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, voidPromise, write, write, writeAndFlush, writeAndFlushprivate static final InternalLogger logger
private final java.net.Socket socket
private final OioSocketChannelConfig config
public OioSocketChannel()
Socketpublic OioSocketChannel(java.net.Socket socket)
Socketsocket - the Socket which is used by this instancepublic OioSocketChannel(Channel parent, java.net.Socket socket)
Socketparent - the parent Channel which was used to create this instance. This can be null if the
has no parent as it was created by your self.socket - the Socket which is used by this instancepublic ServerSocketChannel parent()
Channelparent in interface Channelparent in interface SocketChannelparent in class AbstractChannelnull if this channel does not have a parent channel.public OioSocketChannelConfig config()
Channelconfig in interface Channelconfig in interface SocketChannelpublic boolean isOpen()
Channeltrue if the Channel is open and may get active laterpublic boolean isActive()
Channeltrue if the Channel is active and so connected.isActive in interface ChannelisActive in class OioByteStreamChannelpublic boolean isOutputShutdown()
isOutputShutdown in interface DuplexChannelSocket.isOutputShutdown()public boolean isInputShutdown()
AbstractOioByteChannelisInputShutdown in interface DuplexChannelisInputShutdown in class AbstractOioByteChanneltrue if the input side of this channel is shutdown.public boolean isShutdown()
DuplexChannelisShutdown in interface DuplexChannelpublic ChannelFuture shutdownOutput()
shutdownOutput in interface DuplexChannelSocket.shutdownOutput()public ChannelFuture shutdownInput()
AbstractOioByteChannelshutdownInput in interface DuplexChannelshutdownInput in class AbstractOioByteChannelSocket.shutdownInput()public ChannelFuture shutdown()
DuplexChannelshutdown in interface DuplexChannelprotected int doReadBytes(ByteBuf buf) throws java.lang.Exception
AbstractOioByteChanneldoReadBytes in class OioByteStreamChannelbuf - the ByteBuf into which the read bytes will be writtenjava.lang.Exception - is thrown if an error occurredpublic ChannelFuture shutdownOutput(ChannelPromise promise)
DuplexChannelChannelPromise.shutdownOutput in interface DuplexChannelSocket.shutdownOutput()private void shutdownOutput0(ChannelPromise promise)
public ChannelFuture shutdownInput(ChannelPromise promise)
DuplexChannelChannelPromise.shutdownInput in interface DuplexChannelSocket.shutdownInput()private void shutdownInput0(ChannelPromise promise)
public ChannelFuture shutdown(ChannelPromise promise)
DuplexChannelshutdown in interface DuplexChannelpromise - will be completed when both shutdown operations complete.private void shutdown0(ChannelPromise promise)
public java.net.InetSocketAddress localAddress()
ChannelSocketAddress is supposed to be down-cast into more concrete
type such as InetSocketAddress to retrieve the detailed
information.localAddress in interface ChannellocalAddress in interface SocketChannellocalAddress in class AbstractChannelnull if this channel is not bound.public java.net.InetSocketAddress remoteAddress()
ChannelSocketAddress is supposed to be down-cast into more
concrete type such as InetSocketAddress to retrieve the detailed
information.remoteAddress in interface ChannelremoteAddress in interface SocketChannelremoteAddress in class AbstractChannelnull if this channel is not connected.
If this channel is not connected but it can receive messages
from arbitrary remote addresses (e.g. DatagramChannel,
use DefaultAddressedEnvelope.recipient() to determine
the origination of the received message as this method will
return null.protected java.net.SocketAddress localAddress0()
AbstractChannelSocketAddress which is bound locally.localAddress0 in class AbstractChannelprotected java.net.SocketAddress remoteAddress0()
AbstractChannelSocketAddress which the Channel is connected to.remoteAddress0 in class AbstractChannelprotected void doBind(java.net.SocketAddress localAddress)
throws java.lang.Exception
AbstractChannelChannel to the SocketAddressdoBind in class AbstractChanneljava.lang.Exceptionprotected void doConnect(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
throws java.lang.Exception
AbstractOioChannelnull otherwise.doConnect in class AbstractOioChanneljava.lang.Exceptionprotected void doDisconnect()
throws java.lang.Exception
AbstractChannelChannel from its remote peerdoDisconnect in class AbstractChanneljava.lang.Exceptionprotected void doClose()
throws java.lang.Exception
AbstractChannelChanneldoClose in class OioByteStreamChanneljava.lang.Exceptionprotected boolean checkInputShutdown()
@Deprecated protected void setReadPending(boolean readPending)
setReadPending in class AbstractOioChannelfinal void clearReadPending0()