Package io.netty.channel.epoll
Class AbstractEpollChannel
java.lang.Object
io.netty.util.DefaultAttributeMap
io.netty.channel.AbstractChannel
io.netty.channel.epoll.AbstractEpollChannel
- All Implemented Interfaces:
Channel,ChannelOutboundInvoker,UnixChannel,AttributeMap,Comparable<Channel>
- Direct Known Subclasses:
AbstractEpollServerChannel,AbstractEpollStreamChannel,EpollDatagramChannel,EpollDomainDatagramChannel
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class io.netty.channel.AbstractChannel
AbstractChannel.AbstractUnsafeNested classes/interfaces inherited from interface io.netty.channel.Channel
Channel.Unsafe -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprivate ChannelPromiseThe future of the current connection attempt.private Future<?> (package private) booleanprotected int(package private) booleanprivate SocketAddressprivate static final ChannelMetadataprivate SocketAddressprivate SocketAddressprotected final LinuxSocket -
Constructor Summary
ConstructorsConstructorDescriptionAbstractEpollChannel(Channel parent, LinuxSocket fd, boolean active) AbstractEpollChannel(Channel parent, LinuxSocket fd, SocketAddress remote) -
Method Summary
Modifier and TypeMethodDescriptionprotected static void(package private) final void(package private) voidclearFlag(int flag) abstract EpollChannelConfigconfig()Returns the configuration of this channel.protected final voidSchedule a read operation.protected voiddoBind(SocketAddress local) Bind theChannelto theSocketAddressprotected voiddoClose()Close theChannelprotected booleandoConnect(SocketAddress remoteAddress, SocketAddress localAddress) Connect to the remote peer(package private) booleandoConnect0(SocketAddress remote) protected voidprotected voidDisconnect thisChannelfrom its remote peerprotected final intdoReadBytes(ByteBuf byteBuf) Read bytes into the givenByteBufand return the amount.protected voidprotected final intdoWriteBytes(ChannelOutboundBuffer in, ByteBuf buf) (package private) final longdoWriteOrSendBytes(ByteBuf data, InetSocketAddress remoteAddress, boolean fastOpen) Write bytes to the socket, with or without a remote address.final FileDescriptorfd()Returns theFileDescriptorthat is used by thisChannel.booleanisActive()Returntrueif theChannelis active and so connected.private static booleanisAllowHalfClosure(ChannelConfig config) protected booleanisCompatible(EventLoop loop) Returntrueif the givenEventLoopis compatible with this instance.(package private) booleanisFlagSet(int flag) booleanisOpen()Returnstrueif theChannelis open and may get active later(package private) static booleanisSoErrorZero(Socket fd) protected SocketAddressReturns theSocketAddresswhich is bound locally.metadata()private voidprotected final ByteBufnewDirectBuffer(ByteBuf buf) Returns an off-heap copy of the specifiedByteBuf, and releases the original one.protected final ByteBufnewDirectBuffer(Object holder, ByteBuf buf) Returns an off-heap copy of the specifiedByteBuf, and releases the specified holder.private static ByteBufnewDirectBuffer0(Object holder, ByteBuf buf, ByteBufAllocator alloc, int capacity) protected abstract AbstractEpollChannel.AbstractEpollUnsafeCreate a newAbstractChannel.AbstractUnsafeinstance which will be used for the life-time of theChannelprotected SocketAddressReturn theSocketAddresswhich theChannelis connected to.(package private) voidprotected voidsetFlag(int flag) (package private) final booleanshouldBreakEpollInReady(ChannelConfig config) Methods inherited from class io.netty.channel.AbstractChannel
alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, doShutdownOutput, doWrite, equals, eventLoop, filterOutboundMessage, flush, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, isWritable, localAddress, maxMessagesPerWrite, newChannelPipeline, newFailedFuture, newId, newProgressivePromise, newPromise, newSucceededFuture, parent, pipeline, read, remoteAddress, toString, unsafe, validateFileRegion, voidPromise, write, write, writeAndFlush, writeAndFlushMethods inherited from class io.netty.util.DefaultAttributeMap
attr, hasAttrMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.netty.util.AttributeMap
attr, hasAttrMethods inherited from interface io.netty.channel.Channel
alloc, bytesBeforeUnwritable, bytesBeforeWritable, closeFuture, eventLoop, flush, id, isRegistered, isWritable, localAddress, parent, pipeline, read, remoteAddress, unsafeMethods inherited from interface io.netty.channel.ChannelOutboundInvoker
bind, bind, close, close, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, voidPromise, write, write, writeAndFlush, writeAndFlushMethods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
METADATA
-
socket
-
connectPromise
The future of the current connection attempt. If not null, subsequent connection attempts will fail. -
connectTimeoutFuture
-
requestedRemoteAddress
-
local
-
remote
-
flags
protected int flags -
inputClosedSeenErrorOnRead
boolean inputClosedSeenErrorOnRead -
epollInReadyRunnablePending
boolean epollInReadyRunnablePending -
active
protected volatile boolean active
-
-
Constructor Details
-
AbstractEpollChannel
AbstractEpollChannel(LinuxSocket fd) -
AbstractEpollChannel
AbstractEpollChannel(Channel parent, LinuxSocket fd, boolean active) -
AbstractEpollChannel
AbstractEpollChannel(Channel parent, LinuxSocket fd, SocketAddress remote)
-
-
Method Details
-
isSoErrorZero
-
setFlag
- Throws:
IOException
-
clearFlag
- Throws:
IOException
-
isFlagSet
boolean isFlagSet(int flag) -
fd
Description copied from interface:UnixChannelReturns theFileDescriptorthat is used by thisChannel.- Specified by:
fdin interfaceUnixChannel
-
config
Description copied from interface:ChannelReturns the configuration of this channel. -
isActive
public boolean isActive()Description copied from interface:ChannelReturntrueif theChannelis active and so connected. -
metadata
Description copied from interface:Channel -
doClose
Description copied from class:AbstractChannelClose theChannel- Specified by:
doClosein classAbstractChannel- Throws:
Exception
-
resetCachedAddresses
void resetCachedAddresses() -
doDisconnect
Description copied from class:AbstractChannelDisconnect thisChannelfrom its remote peer- Specified by:
doDisconnectin classAbstractChannel- Throws:
Exception
-
isCompatible
Description copied from class:AbstractChannelReturntrueif the givenEventLoopis compatible with this instance.- Specified by:
isCompatiblein classAbstractChannel
-
isOpen
public boolean isOpen()Description copied from interface:ChannelReturnstrueif theChannelis open and may get active later -
doDeregister
Description copied from class:AbstractChannel- Overrides:
doDeregisterin classAbstractChannel- Throws:
Exception
-
doBeginRead
Description copied from class:AbstractChannelSchedule a read operation.- Specified by:
doBeginReadin classAbstractChannel- Throws:
Exception
-
shouldBreakEpollInReady
-
isAllowHalfClosure
-
clearEpollIn
final void clearEpollIn() -
modifyEvents
- Throws:
IOException
-
doRegister
Description copied from class:AbstractChannelIs called after theChannelis registered with itsEventLoopas part of the register process. Sub-classes may override this method- Overrides:
doRegisterin classAbstractChannel- Throws:
Exception
-
newUnsafe
Description copied from class:AbstractChannelCreate a newAbstractChannel.AbstractUnsafeinstance which will be used for the life-time of theChannel- Specified by:
newUnsafein classAbstractChannel
-
newDirectBuffer
Returns an off-heap copy of the specifiedByteBuf, and releases the original one. -
newDirectBuffer
-
newDirectBuffer0
private static ByteBuf newDirectBuffer0(Object holder, ByteBuf buf, ByteBufAllocator alloc, int capacity) -
checkResolvable
-
doReadBytes
Read bytes into the givenByteBufand return the amount.- Throws:
Exception
-
doWriteBytes
- Throws:
Exception
-
doWriteOrSendBytes
final long doWriteOrSendBytes(ByteBuf data, InetSocketAddress remoteAddress, boolean fastOpen) throws IOException Write bytes to the socket, with or without a remote address. Used for datagram and TCP client fast open writes.- Throws:
IOException
-
doBind
Description copied from class:AbstractChannelBind theChannelto theSocketAddress- Specified by:
doBindin classAbstractChannel- Throws:
Exception
-
doConnect
protected boolean doConnect(SocketAddress remoteAddress, SocketAddress localAddress) throws Exception Connect to the remote peer- Throws:
Exception
-
doConnect0
- Throws:
Exception
-
localAddress0
Description copied from class:AbstractChannelReturns theSocketAddresswhich is bound locally.- Specified by:
localAddress0in classAbstractChannel
-
remoteAddress0
Description copied from class:AbstractChannelReturn theSocketAddresswhich theChannelis connected to.- Specified by:
remoteAddress0in classAbstractChannel
-