Modifier and Type | Field and Description |
---|---|
protected static java.nio.ByteBuffer |
CLOSE_MARKER |
Constructor and Description |
---|
NioEndpoint(SelectorKernel kernel,
long id,
java.nio.channels.SocketChannel socket) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this endpoint without flushing any of its
currently enqueued outbound data.
|
void |
close(boolean flushData)
Closes this endpoint, optionally flushing any queued
data before closing.
|
java.lang.String |
getAddress()
Returns the transport specific remote address of this endpoint
as a string.
|
long |
getId()
Returns an ID that is unique for this endpoint within its
Kernel instance.
|
Kernel |
getKernel()
Returns the kernel to which this endpoint belongs.
|
protected boolean |
hasPending() |
boolean |
isConnected()
Returns true if this endpoint is currently connected.
|
protected java.nio.ByteBuffer |
peekPending()
Called by the SelectorKernel to get the current top
buffer for writing.
|
protected java.nio.ByteBuffer |
removePending()
Called by the SelectorKernel when the top buffer
has been exhausted.
|
void |
send(java.nio.ByteBuffer data)
Sends data to the other end of the connection represented
by this endpoint.
|
protected void |
send(java.nio.ByteBuffer data,
boolean copy,
boolean wakeup)
The wakeup option is used internally when the kernel is
broadcasting out to a bunch of endpoints and doesn't want to
necessarily wakeup right away.
|
java.lang.String |
toString() |
public NioEndpoint(SelectorKernel kernel, long id, java.nio.channels.SocketChannel socket)
public Kernel getKernel()
Endpoint
public void close()
Endpoint
public void close(boolean flushData)
Endpoint
public long getId()
Endpoint
public java.lang.String getAddress()
Endpoint
getAddress
in interface Endpoint
public boolean isConnected()
Endpoint
isConnected
in interface Endpoint
protected void send(java.nio.ByteBuffer data, boolean copy, boolean wakeup)
protected java.nio.ByteBuffer peekPending()
protected java.nio.ByteBuffer removePending()
protected boolean hasPending()
public void send(java.nio.ByteBuffer data)
Endpoint
public java.lang.String toString()
toString
in class java.lang.Object