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 AbstractChannel
AbstractChannel.AbstractUnsafeNested classes/interfaces inherited from interface Channel
Channel.Unsafe -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprivate ChannelPromiseThe future of the current connection attempt.private Future<?> private final EpollIoOps(package private) booleanprivate SocketAddressprivate static final ChannelMetadataprivate EpollIoOpsprivate IoRegistrationprivate SocketAddressprivate SocketAddressprotected final LinuxSocket -
Constructor Summary
ConstructorsConstructorDescriptionAbstractEpollChannel(Channel parent, LinuxSocket fd, boolean active, EpollIoOps initialOps) AbstractEpollChannel(Channel parent, LinuxSocket fd, SocketAddress remote, EpollIoOps initialOps) -
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 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 voiddoRegister(ChannelPromise promise) protected 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()protected 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 final IoRegistrationprotected SocketAddressReturn theSocketAddresswhich theChannelis connected to.(package private) voidprotected voidsetFlag(int flag) (package private) final booleanshouldBreakEpollInReady(ChannelConfig config) (package private) final voidMethods inherited from class AbstractChannel
closeFuture, compareTo, doRegister, doShutdownOutput, doWrite, equals, eventLoop, filterOutboundMessage, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, localAddress, maxMessagesPerWrite, newChannelPipeline, newId, parent, pipeline, remoteAddress, toString, unsafe, validateFileRegion, voidPromiseMethods inherited from class DefaultAttributeMap
attr, hasAttrMethods inherited from interface AttributeMap
attr, hasAttrMethods inherited from interface Channel
alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, closeFuture, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, eventLoop, flush, getOption, id, isRegistered, isWritable, localAddress, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, parent, pipeline, read, remoteAddress, setOption, unsafe, voidPromise, write, write, writeAndFlush, writeAndFlushMethods inherited from interface Comparable
compareTo
-
Field Details
-
METADATA
-
socket
-
initial
-
connectPromise
The future of the current connection attempt. If not null, subsequent connection attempts will fail. -
connectTimeoutFuture
-
requestedRemoteAddress
-
local
-
remote
-
registration
-
inputClosedSeenErrorOnRead
boolean inputClosedSeenErrorOnRead -
ops
-
active
protected volatile boolean active
-
-
Constructor Details
-
AbstractEpollChannel
AbstractEpollChannel(Channel parent, LinuxSocket fd, boolean active, EpollIoOps initialOps) -
AbstractEpollChannel
AbstractEpollChannel(Channel parent, LinuxSocket fd, SocketAddress remote, EpollIoOps initialOps)
-
-
Method Details
-
isSoErrorZero
-
setFlag
- Throws:
IOException
-
clearFlag
- Throws:
IOException
-
registration
-
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
-
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
-
isOpen
-
doDeregister
Description copied from class:AbstractChannel- Overrides:
doDeregisterin classAbstractChannel- Throws:
Exception
-
isCompatible
Description copied from class:AbstractChannelReturntrueif the givenEventLoopis compatible with this instance.- Specified by:
isCompatiblein classAbstractChannel
-
doBeginRead
Description copied from class:AbstractChannelSchedule a read operation.- Specified by:
doBeginReadin classAbstractChannel- Throws:
Exception
-
shouldBreakEpollInReady
-
isAllowHalfClosure
-
clearEpollIn
final void clearEpollIn() -
doRegister
Description copied from class:AbstractChannelIs called after theChannelis registered with itsEventLoopas part of the register process. Subclasses may override this method- Overrides:
doRegisterin classAbstractChannel- Parameters:
promise-ChannelPromisethat must be notified once done to continue the registration.
-
newUnsafe
Description copied from class:AbstractChannelCreate a newAbstractChannel.AbstractUnsafeinstance which will be used for the life-time of theChannel- Specified by:
newUnsafein classAbstractChannel
-
newDirectBuffer
-
newDirectBuffer
-
newDirectBuffer0
private static ByteBuf newDirectBuffer0(Object holder, ByteBuf buf, ByteBufAllocator alloc, int capacity) -
checkResolvable
-
doReadBytes
-
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
-
submitCurrentOps
final void submitCurrentOps() -
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
-