public final class EpollSocketChannel extends AbstractEpollStreamChannel implements SocketChannel
SocketChannel
implementation that uses linux EPOLL Edge-Triggered Mode for
maximal performance.Modifier and Type | Class and Description |
---|---|
private class |
EpollSocketChannel.EpollSocketChannelUnsafe |
AbstractEpollStreamChannel.EpollStreamUnsafe, AbstractEpollStreamChannel.SpliceInTask
AbstractEpollChannel.AbstractEpollUnsafe
AbstractChannel.AbstractUnsafe
Channel.Unsafe
Modifier and Type | Field and Description |
---|---|
private EpollSocketChannelConfig |
config |
private java.net.InetSocketAddress |
local |
private java.net.InetSocketAddress |
remote |
private java.net.InetSocketAddress |
requestedRemote |
private java.util.Collection<java.net.InetAddress> |
tcpMd5SigAddresses |
active, flags
Constructor and Description |
---|
EpollSocketChannel() |
EpollSocketChannel(Channel parent,
Socket fd,
java.net.InetSocketAddress remote) |
EpollSocketChannel(FileDescriptor fd)
Deprecated.
|
EpollSocketChannel(Socket fd,
boolean active)
Creates a new
EpollSocketChannel from an existing FileDescriptor . |
Modifier and Type | Method and Description |
---|---|
private static java.net.InetSocketAddress |
computeRemoteAddr(java.net.InetSocketAddress remoteAddr,
java.net.InetSocketAddress osRemoteAddr) |
EpollSocketChannelConfig |
config()
Returns the configuration of this channel.
|
protected void |
doBind(java.net.SocketAddress local)
Bind the
Channel to the SocketAddress |
protected boolean |
doConnect(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
Connect to the remote peer
|
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. |
protected AbstractEpollChannel.AbstractEpollUnsafe |
newUnsafe()
Create a new
AbstractChannel.AbstractUnsafe instance which will be used for the life-time of the Channel |
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. |
(package private) void |
setTcpMd5Sig(java.util.Map<java.net.InetAddress,byte[]> keys) |
EpollTcpInfo |
tcpInfo()
Returns the
TCP_INFO for the current socket. |
EpollTcpInfo |
tcpInfo(EpollTcpInfo info)
Updates and returns the
TCP_INFO for the current socket. |
doClose, doWrite, doWriteSingle, filterOutboundMessage, isInputShutdown, isOutputShutdown, shutdownOutput, shutdownOutput, shutdownOutput0, spliceTo, spliceTo, spliceTo, spliceTo
checkResolvable, clearEpollIn, clearFlag, doBeginRead, doDeregister, doDisconnect, doReadBytes, doRegister, doWriteBytes, fd, isActive, isCompatible, isFlagSet, isOpen, isSoErrorZero, metadata, newDirectBuffer, newDirectBuffer, setFlag
alloc, bind, bind, close, close, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, equals, eventLoop, flush, hashCode, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, isWritable, newChannelPipeline, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, pipeline, read, toString, unsafe, voidPromise, write, write, writeAndFlush, writeAndFlush
attr
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isInputShutdown, isOutputShutdown, shutdownOutput, shutdownOutput
alloc, bind, bind, close, close, closeFuture, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, eventLoop, flush, isActive, isOpen, isRegistered, isWritable, metadata, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, pipeline, read, unsafe, voidPromise, write, write, writeAndFlush, writeAndFlush
attr
private final EpollSocketChannelConfig config
private volatile java.net.InetSocketAddress local
private volatile java.net.InetSocketAddress remote
private java.net.InetSocketAddress requestedRemote
private volatile java.util.Collection<java.net.InetAddress> tcpMd5SigAddresses
public EpollSocketChannel()
@Deprecated public EpollSocketChannel(FileDescriptor fd)
EpollSocketChannel(Socket, boolean)
.public EpollSocketChannel(Socket fd, boolean active)
EpollSocketChannel
from an existing FileDescriptor
.public EpollTcpInfo tcpInfo()
TCP_INFO
for the current socket. See man 7 tcp.public EpollTcpInfo tcpInfo(EpollTcpInfo info)
TCP_INFO
for the current socket.
See man 7 tcp.public java.net.InetSocketAddress remoteAddress()
Channel
SocketAddress
is supposed to be down-cast into more
concrete type such as InetSocketAddress
to retrieve the detailed
information.remoteAddress
in interface Channel
remoteAddress
in interface SocketChannel
remoteAddress
in class AbstractChannel
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
,
use DefaultAddressedEnvelope.recipient()
to determine
the origination of the received message as this method will
return null
.public java.net.InetSocketAddress localAddress()
Channel
SocketAddress
is supposed to be down-cast into more concrete
type such as InetSocketAddress
to retrieve the detailed
information.localAddress
in interface Channel
localAddress
in interface SocketChannel
localAddress
in class AbstractChannel
null
if this channel is not bound.protected java.net.SocketAddress localAddress0()
AbstractChannel
SocketAddress
which is bound locally.localAddress0
in class AbstractChannel
protected java.net.SocketAddress remoteAddress0()
AbstractChannel
SocketAddress
which the Channel
is connected to.remoteAddress0
in class AbstractChannel
protected void doBind(java.net.SocketAddress local) throws java.lang.Exception
AbstractChannel
Channel
to the SocketAddress
doBind
in class AbstractChannel
java.lang.Exception
public EpollSocketChannelConfig config()
Channel
config
in interface Channel
config
in interface SocketChannel
config
in class AbstractEpollChannel
public ServerSocketChannel parent()
Channel
parent
in interface Channel
parent
in interface SocketChannel
parent
in class AbstractChannel
null
if this channel does not have a parent channel.protected AbstractEpollChannel.AbstractEpollUnsafe newUnsafe()
AbstractChannel
AbstractChannel.AbstractUnsafe
instance which will be used for the life-time of the Channel
newUnsafe
in class AbstractEpollStreamChannel
private static java.net.InetSocketAddress computeRemoteAddr(java.net.InetSocketAddress remoteAddr, java.net.InetSocketAddress osRemoteAddr)
protected boolean doConnect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress) throws java.lang.Exception
AbstractEpollStreamChannel
doConnect
in class AbstractEpollStreamChannel
java.lang.Exception
void setTcpMd5Sig(java.util.Map<java.net.InetAddress,byte[]> keys) throws java.io.IOException
java.io.IOException