abstract class AbstractKQueueChannel extends AbstractChannel implements UnixChannel
Modifier and Type | Class and Description |
---|---|
(package private) class |
AbstractKQueueChannel.AbstractKQueueUnsafe |
AbstractChannel.AbstractUnsafe
Channel.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, writeAndFlush
attr, hasAttr
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
alloc, bytesBeforeUnwritable, bytesBeforeWritable, closeFuture, eventLoop, flush, id, isRegistered, isWritable, localAddress, parent, pipeline, read, remoteAddress, unsafe
attr, hasAttr
bind, bind, close, close, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, voidPromise, write, write, writeAndFlush, writeAndFlush
private 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()
UnixChannel
FileDescriptor
that is used by this Channel
.fd
in interface UnixChannel
public boolean isActive()
Channel
true
if the Channel
is active and so connected.public ChannelMetadata metadata()
Channel
protected void doClose() throws java.lang.Exception
AbstractChannel
Channel
doClose
in class AbstractChannel
java.lang.Exception
protected void doDisconnect() throws java.lang.Exception
AbstractChannel
Channel
from its remote peerdoDisconnect
in class AbstractChannel
java.lang.Exception
protected boolean isCompatible(EventLoop loop)
AbstractChannel
true
if the given EventLoop
is compatible with this instance.isCompatible
in class AbstractChannel
public boolean isOpen()
Channel
true
if the Channel
is open and may get active laterprotected void doDeregister() throws java.lang.Exception
AbstractChannel
doDeregister
in class AbstractChannel
java.lang.Exception
protected final void doBeginRead() throws java.lang.Exception
AbstractChannel
doBeginRead
in class AbstractChannel
java.lang.Exception
protected void doRegister() throws java.lang.Exception
AbstractChannel
Channel
is registered with its EventLoop
as part of the register process.
Sub-classes may override this methoddoRegister
in class AbstractChannel
java.lang.Exception
protected abstract AbstractKQueueChannel.AbstractKQueueUnsafe newUnsafe()
AbstractChannel
AbstractChannel.AbstractUnsafe
instance which will be used for the life-time of the Channel
newUnsafe
in class AbstractChannel
public abstract KQueueChannelConfig config()
Channel
protected 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.Exception
protected final int doWriteBytes(ByteBuf buf, int writeSpinCount) throws java.lang.Exception
java.lang.Exception
final boolean shouldBreakReadReady(ChannelConfig config)
final boolean isAllowHalfClosure(ChannelConfig config)
final void clearReadFilter()
void readFilter(boolean readFilterEnabled) throws java.io.IOException
java.io.IOException
void writeFilter(boolean writeFilterEnabled) throws java.io.IOException
java.io.IOException
private void evSet(short filter, short flags)
private void evSet0(short filter, short flags)