Package io.netty.channel.kqueue
Class AbstractKQueueChannel
- java.lang.Object
-
- io.netty.util.DefaultAttributeMap
-
- io.netty.channel.AbstractChannel
-
- io.netty.channel.kqueue.AbstractKQueueChannel
-
- All Implemented Interfaces:
Channel,ChannelOutboundInvoker,UnixChannel,AttributeMap,java.lang.Comparable<Channel>
- Direct Known Subclasses:
AbstractKQueueDatagramChannel,AbstractKQueueServerChannel,AbstractKQueueStreamChannel
abstract class AbstractKQueueChannel extends AbstractChannel implements UnixChannel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classAbstractKQueueChannel.AbstractKQueueUnsafe-
Nested classes/interfaces inherited from class io.netty.channel.AbstractChannel
AbstractChannel.AbstractUnsafe
-
Nested classes/interfaces inherited from interface io.netty.channel.Channel
Channel.Unsafe
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanactiveprivate ChannelPromiseconnectPromiseThe future of the current connection attempt.private Future<?>connectTimeoutFuture(package private) booleaninputClosedSeenErrorOnReadprivate java.net.SocketAddresslocalprivate static ChannelMetadataMETADATAprivate booleanreadFilterEnabled(package private) booleanreadReadyRunnablePending(package private) KQueueEventLoop.KQueueRegistrationregistrationprivate java.net.SocketAddressremoteprivate java.net.SocketAddressrequestedRemoteAddress(package private) BsdSocketsocketprivate booleanwriteFilterEnabled
-
Constructor Summary
Constructors Constructor Description AbstractKQueueChannel(Channel parent, BsdSocket fd, boolean active)AbstractKQueueChannel(Channel parent, BsdSocket fd, java.net.SocketAddress remote)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static voidcheckResolvable(java.net.InetSocketAddress addr)private voidclearRdHup0()(package private) voidclearReadFilter()abstract KQueueChannelConfigconfig()Returns the configuration of this channel.protected voiddoBeginRead()Schedule a read operation.protected voiddoBind(java.net.SocketAddress local)Bind theChannelto theSocketAddressprotected voiddoClose()Close theChannelprotected booleandoConnect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress)Connect to the remote peerprotected booleandoConnect0(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress)protected voiddoDeregister()protected voiddoDisconnect()Disconnect thisChannelfrom its remote peerprotected intdoReadBytes(ByteBuf byteBuf)Read bytes into the givenByteBufand return the amount.protected voiddoRegister()protected intdoWriteBytes(ChannelOutboundBuffer in, ByteBuf buf)private voidevSet(short filter, short flags)private voidevSet0(short filter, short flags)private voidevSet0(short filter, short flags, int fflags)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.booleanisOpen()Returnstrueif theChannelis open and may get active later(package private) static booleanisSoErrorZero(BsdSocket fd)protected java.net.SocketAddresslocalAddress0()Returns theSocketAddresswhich is bound locally.ChannelMetadatametadata()protected ByteBufnewDirectBuffer(ByteBuf buf)Returns an off-heap copy of the specifiedByteBuf, and releases the original one.protected ByteBufnewDirectBuffer(java.lang.Object holder, ByteBuf buf)Returns an off-heap copy of the specifiedByteBuf, and releases the specified holder.private static ByteBufnewDirectBuffer0(java.lang.Object holder, ByteBuf buf, ByteBufAllocator alloc, int capacity)protected abstract AbstractKQueueChannel.AbstractKQueueUnsafenewUnsafe()Create a newAbstractChannel.AbstractUnsafeinstance which will be used for the life-time of theChannel(package private) voidreadFilter(boolean readFilterEnabled)protected java.net.SocketAddressremoteAddress0()Return theSocketAddresswhich theChannelis connected to.(package private) voidresetCachedAddresses()(package private) booleanshouldBreakReadReady(ChannelConfig config)(package private) voidunregisterFilters()(package private) voidwriteFilter(boolean writeFilterEnabled)-
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, writeAndFlush
-
Methods inherited from class io.netty.util.DefaultAttributeMap
attr, hasAttr
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty.util.AttributeMap
attr, hasAttr
-
Methods inherited from interface io.netty.channel.Channel
alloc, bytesBeforeUnwritable, bytesBeforeWritable, closeFuture, eventLoop, flush, id, isRegistered, isWritable, localAddress, parent, pipeline, read, remoteAddress, unsafe
-
Methods 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, writeAndFlush
-
-
-
-
Field Detail
-
METADATA
private static final ChannelMetadata METADATA
-
connectPromise
private ChannelPromise connectPromise
The future of the current connection attempt. If not null, subsequent connection attempts will fail.
-
connectTimeoutFuture
private Future<?> connectTimeoutFuture
-
requestedRemoteAddress
private java.net.SocketAddress requestedRemoteAddress
-
socket
final BsdSocket socket
-
readFilterEnabled
private boolean readFilterEnabled
-
writeFilterEnabled
private boolean writeFilterEnabled
-
registration
KQueueEventLoop.KQueueRegistration registration
-
readReadyRunnablePending
boolean readReadyRunnablePending
-
inputClosedSeenErrorOnRead
boolean inputClosedSeenErrorOnRead
-
active
protected volatile boolean active
-
local
private volatile java.net.SocketAddress local
-
remote
private volatile java.net.SocketAddress remote
-
-
Method Detail
-
isSoErrorZero
static boolean isSoErrorZero(BsdSocket fd)
-
fd
public final FileDescriptor fd()
Description copied from interface:UnixChannelReturns theFileDescriptorthat is used by thisChannel.- Specified by:
fdin interfaceUnixChannel
-
isActive
public boolean isActive()
Description copied from interface:ChannelReturntrueif theChannelis active and so connected.
-
metadata
public ChannelMetadata metadata()
Description copied from interface:Channel
-
doClose
protected void doClose() throws java.lang.ExceptionDescription copied from class:AbstractChannelClose theChannel- Specified by:
doClosein classAbstractChannel- Throws:
java.lang.Exception
-
doDisconnect
protected void doDisconnect() throws java.lang.ExceptionDescription copied from class:AbstractChannelDisconnect thisChannelfrom its remote peer- Specified by:
doDisconnectin classAbstractChannel- Throws:
java.lang.Exception
-
resetCachedAddresses
void resetCachedAddresses()
-
isCompatible
protected boolean isCompatible(EventLoop loop)
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
protected void doDeregister() throws java.lang.ExceptionDescription copied from class:AbstractChannel- Overrides:
doDeregisterin classAbstractChannel- Throws:
java.lang.Exception
-
unregisterFilters
void unregisterFilters() throws java.lang.Exception- Throws:
java.lang.Exception
-
clearRdHup0
private void clearRdHup0()
-
doBeginRead
protected final void doBeginRead() throws java.lang.ExceptionDescription copied from class:AbstractChannelSchedule a read operation.- Specified by:
doBeginReadin classAbstractChannel- Throws:
java.lang.Exception
-
doRegister
protected void doRegister() throws java.lang.ExceptionDescription 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:
java.lang.Exception
-
newUnsafe
protected abstract AbstractKQueueChannel.AbstractKQueueUnsafe newUnsafe()
Description copied from class:AbstractChannelCreate a newAbstractChannel.AbstractUnsafeinstance which will be used for the life-time of theChannel- Specified by:
newUnsafein classAbstractChannel
-
config
public abstract KQueueChannelConfig config()
Description copied from interface:ChannelReturns the configuration of this channel.
-
newDirectBuffer
protected final ByteBuf newDirectBuffer(ByteBuf buf)
Returns an off-heap copy of the specifiedByteBuf, and releases the original one.
-
newDirectBuffer0
private static ByteBuf newDirectBuffer0(java.lang.Object holder, ByteBuf buf, ByteBufAllocator alloc, int capacity)
-
checkResolvable
protected static void checkResolvable(java.net.InetSocketAddress addr)
-
doReadBytes
protected final int doReadBytes(ByteBuf byteBuf) throws java.lang.Exception
Read bytes into the givenByteBufand return the amount.- Throws:
java.lang.Exception
-
doWriteBytes
protected final int doWriteBytes(ChannelOutboundBuffer in, ByteBuf buf) throws java.lang.Exception
- Throws:
java.lang.Exception
-
shouldBreakReadReady
final boolean shouldBreakReadReady(ChannelConfig config)
-
isAllowHalfClosure
private static boolean isAllowHalfClosure(ChannelConfig config)
-
clearReadFilter
final void clearReadFilter()
-
readFilter
void readFilter(boolean readFilterEnabled) throws java.io.IOException- Throws:
java.io.IOException
-
writeFilter
void writeFilter(boolean writeFilterEnabled) throws java.io.IOException- Throws:
java.io.IOException
-
evSet
private void evSet(short filter, short flags)
-
evSet0
private void evSet0(short filter, short flags)
-
evSet0
private void evSet0(short filter, short flags, int fflags)
-
doBind
protected void doBind(java.net.SocketAddress local) throws java.lang.ExceptionDescription copied from class:AbstractChannelBind theChannelto theSocketAddress- Specified by:
doBindin classAbstractChannel- Throws:
java.lang.Exception
-
doConnect
protected boolean doConnect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress) throws java.lang.ExceptionConnect to the remote peer- Throws:
java.lang.Exception
-
doConnect0
protected boolean doConnect0(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress) throws java.lang.Exception- Throws:
java.lang.Exception
-
localAddress0
protected java.net.SocketAddress localAddress0()
Description copied from class:AbstractChannelReturns theSocketAddresswhich is bound locally.- Specified by:
localAddress0in classAbstractChannel
-
remoteAddress0
protected java.net.SocketAddress remoteAddress0()
Description copied from class:AbstractChannelReturn theSocketAddresswhich theChannelis connected to.- Specified by:
remoteAddress0in classAbstractChannel
-
-