java.io.Closeable, java.lang.AutoCloseable, EndPoint, ManagedSelector.SelectableSocketChannelEndPointpublic abstract class ChannelEndPoint extends AbstractEndPoint implements ManagedSelector.Selectable
Holds the channel and socket for an NIO endpoint.
| Modifier and Type | Field | Description |
|---|---|---|
protected int |
_currentInterestOps |
The current value for
SelectionKey.interestOps(). |
protected int |
_desiredInterestOps |
The desired value for
SelectionKey.interestOps(). |
protected java.nio.channels.SelectionKey |
_key |
|
protected ManagedSelector |
_selector |
| Constructor | Description |
|---|---|
ChannelEndPoint(java.nio.channels.ByteChannel channel,
ManagedSelector selector,
java.nio.channels.SelectionKey key,
Scheduler scheduler) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
doClose() |
|
int |
fill(java.nio.ByteBuffer buffer) |
Fill the passed buffer with data from this endpoint.
|
boolean |
flush(java.nio.ByteBuffer... buffers) |
Flush data from the passed header/buffer to this endpoint.
|
java.nio.channels.ByteChannel |
getChannel() |
|
java.lang.Object |
getTransport() |
|
boolean |
isOpen() |
This abstract method should be called to check if idle timeouts
should still be checked.
|
boolean |
isOptimizedForDirectBuffers() |
Is the endpoint optimized for DirectBuffer usage
|
protected void |
needsFillInterest() |
|
void |
onClose() |
Callback method invoked when this
EndPoint is close. |
protected void |
onIncompleteFlush() |
|
java.lang.Runnable |
onSelected() |
Callback method invoked when a read or write events has been
detected by the
ManagedSelector for this endpoint. |
java.lang.String |
toEndPointString() |
|
void |
updateKey() |
Callback method invoked when all the keys selected by the
ManagedSelector for this endpoint have been processed. |
checkFill, checkFlush, close, close, doShutdownInput, doShutdownOutput, fillInterested, getConnection, getCreatedTimeStamp, getFillInterest, getWriteFlusher, isFillInterested, isInputShutdown, isOutputShutdown, onClose, onIdleExpired, onOpen, reset, setConnection, shutdownInput, shutdownOutput, toConnectionString, toString, tryFillInterested, upgrade, writegetIdleTimeout, getLocalAddress, getRemoteAddress, setIdleTimeoutcheckIdleTimeout, getIdleFor, getIdleTimeout, getIdleTimestamp, getScheduler, notIdle, setIdleTimeoutprotected final ManagedSelector _selector
protected final java.nio.channels.SelectionKey _key
protected int _currentInterestOps
SelectionKey.interestOps().protected int _desiredInterestOps
SelectionKey.interestOps().public ChannelEndPoint(java.nio.channels.ByteChannel channel,
ManagedSelector selector,
java.nio.channels.SelectionKey key,
Scheduler scheduler)
public boolean isOptimizedForDirectBuffers()
EndPointisOptimizedForDirectBuffers in interface EndPointisOptimizedForDirectBuffers in class AbstractEndPointpublic boolean isOpen()
IdleTimeoutisOpen in interface EndPointisOpen in class AbstractEndPointpublic void doClose()
doClose in class AbstractEndPointpublic void onClose()
EndPointCallback method invoked when this EndPoint is close.
onClose in interface EndPointonClose in class AbstractEndPointEndPoint.onOpen()public int fill(java.nio.ByteBuffer buffer)
throws java.io.IOException
EndPointfill in interface EndPointbuffer - The buffer to fill. The position and limit are modified during the fill. After the
operation, the position is unchanged and the limit is increased to reflect the new data filled.int value indicating the number of bytes
filled or -1 if EOF is read or the input is shutdown.java.io.IOException - if the endpoint is closed.public boolean flush(java.nio.ByteBuffer... buffers)
throws java.io.IOException
EndPointflush in interface EndPointbuffers - the buffers to flushjava.io.IOException - If the endpoint is closed or output is shutdown.public java.nio.channels.ByteChannel getChannel()
public java.lang.Object getTransport()
getTransport in interface EndPointprotected void needsFillInterest()
needsFillInterest in class AbstractEndPointprotected void onIncompleteFlush()
onIncompleteFlush in class AbstractEndPointpublic java.lang.Runnable onSelected()
ManagedSelector.SelectableManagedSelector for this endpoint.onSelected in interface ManagedSelector.Selectablepublic void updateKey()
ManagedSelector.SelectableManagedSelector for this endpoint have been processed.updateKey in interface ManagedSelector.Selectablepublic java.lang.String toEndPointString()
toEndPointString in class AbstractEndPointCopyright © 1995–2018 Webtide. All rights reserved.