abstract class AbstractKQueueChannel extends AbstractChannel implements UnixChannel
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
AbstractKQueueChannel.AbstractKQueueUnsafe |
AbstractChannel.AbstractUnsafeChannel.Unsafe| Modifier and Type | Field and Description |
|---|---|
protected boolean |
active |
(package private) boolean |
inputClosedSeenErrorOnRead |
(package private) long |
jniSelfPtr
This member variable means we don't have to have a map in
KQueueEventLoop which associates the FDs
from kqueue to instances of this class. |
private static ChannelMetadata |
METADATA |
private boolean |
readFilterEnabled |
(package private) boolean |
readReadyRunnablePending |
(package private) BsdSocket |
socket |
private boolean |
writeFilterEnabled |
| Constructor and Description |
|---|
AbstractKQueueChannel(Channel parent,
BsdSocket fd,
boolean active) |
AbstractKQueueChannel(Channel parent,
BsdSocket fd,
boolean active,
boolean writeFilterEnabled) |
| Modifier and Type | Method and Description |
|---|---|
protected static void |
checkResolvable(java.net.InetSocketAddress addr) |
(package private) void |
clearReadFilter() |
abstract KQueueChannelConfig |
config()
Returns the configuration of this channel.
|
protected void |
doBeginRead()
Schedule a read operation.
|
protected void |
doClose()
Close the
Channel |
protected void |
doDeregister()
|
protected void |
doDisconnect()
Disconnect this
Channel from its remote peer |
protected int |
doReadBytes(ByteBuf byteBuf)
Read bytes into the given
ByteBuf and return the amount. |
protected void |
doRegister()
|
protected int |
doWriteBytes(ByteBuf buf,
int writeSpinCount) |
private void |
evSet(short filter,
short flags) |
private void |
evSet0(short filter,
short flags) |
FileDescriptor |
fd()
Returns the
FileDescriptor that is used by this Channel. |
boolean |
isActive()
Return
true if the Channel is active and so connected. |
(package private) boolean |
isAllowHalfClosure(ChannelConfig config) |
protected boolean |
isCompatible(EventLoop loop)
Return
true if the given EventLoop is compatible with this instance. |
boolean |
isOpen()
Returns
true if the Channel is open and may get active later |
(package private) static boolean |
isSoErrorZero(BsdSocket fd) |
ChannelMetadata |
metadata()
|
protected ByteBuf |
newDirectBuffer(ByteBuf buf)
Returns an off-heap copy of the specified
ByteBuf, and releases the original one. |
protected ByteBuf |
newDirectBuffer(java.lang.Object holder,
ByteBuf buf)
Returns an off-heap copy of the specified
ByteBuf, and releases the specified holder. |
private static ByteBuf |
newDirectBuffer0(java.lang.Object holder,
ByteBuf buf,
ByteBufAllocator alloc,
int capacity) |
protected abstract AbstractKQueueChannel.AbstractKQueueUnsafe |
newUnsafe()
Create a new
AbstractChannel.AbstractUnsafe instance which will be used for the life-time of the Channel |
(package private) void |
readFilter(boolean readFilterEnabled) |
(package private) boolean |
shouldBreakReadReady(ChannelConfig config) |
(package private) void |
writeFilter(boolean writeFilterEnabled) |
alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, doBind, doWrite, equals, eventLoop, filterOutboundMessage, flush, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, isWritable, localAddress, localAddress0, newChannelPipeline, newFailedFuture, newId, newProgressivePromise, newPromise, newSucceededFuture, parent, pipeline, read, remoteAddress, remoteAddress0, toString, unsafe, voidPromise, write, write, writeAndFlush, writeAndFlushattr, hasAttrclone, finalize, getClass, notify, notifyAll, wait, wait, waitalloc, bytesBeforeUnwritable, bytesBeforeWritable, closeFuture, eventLoop, flush, id, isRegistered, isWritable, localAddress, parent, pipeline, read, remoteAddress, unsafeattr, hasAttrbind, bind, close, close, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, voidPromise, write, write, writeAndFlush, writeAndFlushprivate static final ChannelMetadata METADATA
final BsdSocket socket
private boolean readFilterEnabled
private boolean writeFilterEnabled
boolean readReadyRunnablePending
boolean inputClosedSeenErrorOnRead
long jniSelfPtr
KQueueEventLoop which associates the FDs
from kqueue to instances of this class. This field will be initialized by JNI when modifying kqueue events.
If there is no global reference when JNI gets a kqueue evSet call (aka this field is 0) then a global reference
will be created and the address will be saved in this member variable. Then when we process a kevent in Java
we can ask JNI to give us the AbstractKQueueChannel that corresponds to that event.protected volatile boolean active
static boolean isSoErrorZero(BsdSocket fd)
public final FileDescriptor fd()
UnixChannelFileDescriptor that is used by this Channel.fd in interface UnixChannelpublic boolean isActive()
Channeltrue if the Channel is active and so connected.public ChannelMetadata metadata()
Channelprotected void doClose()
throws java.lang.Exception
AbstractChannelChanneldoClose in class AbstractChanneljava.lang.Exceptionprotected void doDisconnect()
throws java.lang.Exception
AbstractChannelChannel from its remote peerdoDisconnect in class AbstractChanneljava.lang.Exceptionprotected boolean isCompatible(EventLoop loop)
AbstractChanneltrue if the given EventLoop is compatible with this instance.isCompatible in class AbstractChannelpublic boolean isOpen()
Channeltrue if the Channel is open and may get active laterprotected void doDeregister()
throws java.lang.Exception
AbstractChanneldoDeregister in class AbstractChanneljava.lang.Exceptionprotected final void doBeginRead()
throws java.lang.Exception
AbstractChanneldoBeginRead in class AbstractChanneljava.lang.Exceptionprotected void doRegister()
throws java.lang.Exception
AbstractChannelChannel is registered with its EventLoop as part of the register process.
Sub-classes may override this methoddoRegister in class AbstractChanneljava.lang.Exceptionprotected abstract AbstractKQueueChannel.AbstractKQueueUnsafe newUnsafe()
AbstractChannelAbstractChannel.AbstractUnsafe instance which will be used for the life-time of the ChannelnewUnsafe in class AbstractChannelpublic abstract KQueueChannelConfig config()
Channelprotected final ByteBuf newDirectBuffer(ByteBuf buf)
ByteBuf, and releases the original one.private static ByteBuf newDirectBuffer0(java.lang.Object holder, ByteBuf buf, ByteBufAllocator alloc, int capacity)
protected static void checkResolvable(java.net.InetSocketAddress addr)
protected final int doReadBytes(ByteBuf byteBuf) throws java.lang.Exception
ByteBuf and return the amount.java.lang.Exceptionprotected final int doWriteBytes(ByteBuf buf, int writeSpinCount) throws java.lang.Exception
java.lang.Exceptionfinal boolean shouldBreakReadReady(ChannelConfig config)
final boolean isAllowHalfClosure(ChannelConfig config)
final void clearReadFilter()
void readFilter(boolean readFilterEnabled)
throws java.io.IOException
java.io.IOExceptionvoid writeFilter(boolean writeFilterEnabled)
throws java.io.IOException
java.io.IOExceptionprivate void evSet(short filter,
short flags)
private void evSet0(short filter,
short flags)