public abstract class AbstractEndPoint extends IdleTimeout implements EndPoint
Modifier | Constructor and Description |
---|---|
protected |
AbstractEndPoint(Scheduler scheduler,
InetSocketAddress local,
InetSocketAddress remote) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close any backing stream associated with the endpoint
|
void |
fillInterested(Callback callback)
Requests callback methods to be invoked when a call to
EndPoint.fill(ByteBuffer) would return data or EOF. |
Connection |
getConnection() |
long |
getCreatedTimeStamp() |
FillInterest |
getFillInterest() |
InetSocketAddress |
getLocalAddress() |
InetSocketAddress |
getRemoteAddress() |
protected WriteFlusher |
getWriteFlusher() |
boolean |
isFillInterested() |
boolean |
isOptimizedForDirectBuffers()
Is the endpoint optimized for DirectBuffer usage
|
protected abstract void |
needsFillInterest() |
void |
onClose()
Callback method invoked when this
EndPoint is close. |
protected void |
onIdleExpired(TimeoutException timeout)
This abstract method is called when the idle timeout has expired.
|
protected abstract void |
onIncompleteFlush() |
void |
onOpen()
Callback method invoked when this
EndPoint is opened. |
void |
setConnection(Connection connection) |
String |
toString() |
void |
upgrade(Connection newConnection)
Upgrade connections.
|
void |
write(Callback callback,
ByteBuffer... buffers)
Writes the given buffers via
EndPoint.flush(ByteBuffer...) and invokes callback methods when either
all the data has been flushed or an error occurs. |
checkIdleTimeout, getIdleFor, getIdleTimeout, getIdleTimestamp, getScheduler, isOpen, notIdle, setIdleTimeout
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
fill, flush, getIdleTimeout, getTransport, isInputShutdown, isOpen, isOutputShutdown, setIdleTimeout, shutdownOutput
protected AbstractEndPoint(Scheduler scheduler, InetSocketAddress local, InetSocketAddress remote)
public long getCreatedTimeStamp()
getCreatedTimeStamp
in interface EndPoint
public InetSocketAddress getLocalAddress()
getLocalAddress
in interface EndPoint
EndPoint
is bound, or null
if this EndPoint
does not represent a network connection.public InetSocketAddress getRemoteAddress()
getRemoteAddress
in interface EndPoint
EndPoint
is bound, or null
if this EndPoint
does not represent a network connection.public Connection getConnection()
getConnection
in interface EndPoint
Connection
associated with this EndPoint
EndPoint.setConnection(Connection)
public void setConnection(Connection connection)
setConnection
in interface EndPoint
connection
- the Connection
associated with this EndPoint
EndPoint.getConnection()
,
EndPoint.upgrade(Connection)
public boolean isOptimizedForDirectBuffers()
EndPoint
isOptimizedForDirectBuffers
in interface EndPoint
public void onOpen()
EndPoint
Callback method invoked when this EndPoint
is opened.
onOpen
in interface EndPoint
onOpen
in class IdleTimeout
EndPoint.onClose()
public void onClose()
EndPoint
Callback method invoked when this EndPoint
is close.
onClose
in interface EndPoint
onClose
in class IdleTimeout
EndPoint.onOpen()
public void close()
EndPoint
public void fillInterested(Callback callback) throws IllegalStateException
EndPoint
Requests callback methods to be invoked when a call to EndPoint.fill(ByteBuffer)
would return data or EOF.
fillInterested
in interface EndPoint
callback
- the callback to call when an error occurs or we are readable.ReadPendingException
- if another read operation is concurrent.IllegalStateException
public boolean isFillInterested()
isFillInterested
in interface EndPoint
EndPoint.fillInterested(Callback)
has been called, but EndPoint.fill(ByteBuffer)
has not yet
been calledpublic void write(Callback callback, ByteBuffer... buffers) throws IllegalStateException
EndPoint
Writes the given buffers via EndPoint.flush(ByteBuffer...)
and invokes callback methods when either
all the data has been flushed or an error occurs.
write
in interface EndPoint
callback
- the callback to call when an error occurs or the write completed.buffers
- one or more ByteBuffer
s that will be flushed.WritePendingException
- if another write operation is concurrent.IllegalStateException
protected abstract void onIncompleteFlush()
protected abstract void needsFillInterest() throws IOException
IOException
public FillInterest getFillInterest()
protected WriteFlusher getWriteFlusher()
protected void onIdleExpired(TimeoutException timeout)
IdleTimeout
onIdleExpired
in class IdleTimeout
timeout
- a TimeoutExceptionpublic void upgrade(Connection newConnection)
EndPoint
Connection.UpgradeFrom
then
a prefilled buffer is requested and passed to the newConnection if it is an instance
of Connection.UpgradeTo
Copyright © 1995-2016 Webtide. All Rights Reserved.