public abstract class AbstractEndPoint extends Object implements EndPoint
Modifier | Constructor and Description |
---|---|
protected |
AbstractEndPoint(Scheduler scheduler,
InetSocketAddress local,
InetSocketAddress remote) |
Modifier and Type | Method and Description |
---|---|
protected long |
checkIdleTimeout() |
<C> void |
fillInterested(C context,
Callback<C> callback)
Requests callback methods to be invoked when a call to
EndPoint.fill(ByteBuffer) would return data or EOF. |
Connection |
getConnection() |
long |
getCreatedTimeStamp() |
protected FillInterest |
getFillInterest() |
long |
getIdleTimeout()
Get the max idle time in ms.
|
long |
getIdleTimestamp() |
InetSocketAddress |
getLocalAddress() |
InetSocketAddress |
getRemoteAddress() |
protected WriteFlusher |
getWriteFlusher() |
protected abstract boolean |
needsFill() |
protected void |
notIdle() |
void |
onClose()
Callback method invoked when this
EndPoint is close. |
protected abstract void |
onIncompleteFlush() |
void |
onOpen()
Callback method invoked when this
EndPoint is opened. |
protected void |
scheduleIdleTimeout(long delay) |
void |
setConnection(Connection connection) |
void |
setIdleTimeout(long idleTimeout)
Set the idle timeout.
|
String |
toString() |
<C> void |
write(C context,
Callback<C> 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. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
close, fill, flush, getTransport, isInputShutdown, isOpen, isOutputShutdown, shutdownOutput
protected AbstractEndPoint(Scheduler scheduler, InetSocketAddress local, InetSocketAddress remote)
public long getCreatedTimeStamp()
getCreatedTimeStamp
in interface EndPoint
public long getIdleTimeout()
EndPoint
The max idle time is the time the endpoint can be idle before extraordinary handling takes place.
getIdleTimeout
in interface EndPoint
public void setIdleTimeout(long idleTimeout)
EndPoint
setIdleTimeout
in interface EndPoint
idleTimeout
- the idle timeout in MS. Timeout <= 0 implies an infinite timeoutpublic 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 long getIdleTimestamp()
protected void notIdle()
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()
public void onOpen()
EndPoint
Callback method invoked when this EndPoint
is opened.
onOpen
in interface EndPoint
EndPoint.onClose()
public void onClose()
EndPoint
Callback method invoked when this EndPoint
is close.
onClose
in interface EndPoint
EndPoint.onOpen()
public <C> void fillInterested(C context, Callback<C> 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
context
- the context to return via the callbackcallback
- the callback to call when an error occurs or we are readable.ReadPendingException
- if another read operation is concurrent.IllegalStateException
public <C> void write(C context, Callback<C> 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
context
- the context to return via the callbackcallback
- 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 boolean needsFill() throws IOException
IOException
protected FillInterest getFillInterest()
protected WriteFlusher getWriteFlusher()
protected void scheduleIdleTimeout(long delay)
protected long checkIdleTimeout()
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.