public class EmptyAsyncEndPoint extends Object implements AsyncEndPoint
Constructor and Description |
---|
EmptyAsyncEndPoint() |
Modifier and Type | Method and Description |
---|---|
void |
asyncDispatch()
Dispatch the endpoint.
|
boolean |
blockReadable(long millisecs) |
boolean |
blockWritable(long millisecs) |
void |
cancelTimeout(Timeout.Task task) |
void |
close()
Close any backing stream associated with the endpoint
|
void |
dispatch()
Dispatch the endpoint if it is not already dispatched
|
int |
fill(Buffer buffer)
Fill the buffer from the current putIndex to it's capacity from whatever
byte source is backing the buffer.
|
void |
flush()
Flush any buffered output.
|
int |
flush(Buffer buffer)
Flush the buffer from the current getIndex to it's putIndex using whatever byte
sink is backing the buffer.
|
int |
flush(Buffer header,
Buffer buffer,
Buffer trailer)
Flush the buffer from the current getIndex to it's putIndex using whatever byte
sink is backing the buffer.
|
Connection |
getConnection() |
String |
getLocalAddr() |
String |
getLocalHost() |
int |
getLocalPort() |
int |
getMaxIdleTime()
Get the max idle time in ms.
|
String |
getRemoteAddr() |
String |
getRemoteHost() |
int |
getRemotePort() |
Object |
getTransport() |
boolean |
hasProgressed() |
boolean |
isBlocking() |
boolean |
isCheckForIdle()
Get if the endpoint should be checked for idleness
|
boolean |
isInputShutdown() |
boolean |
isOpen() |
boolean |
isOutputShutdown() |
boolean |
isWritable() |
void |
onIdleExpired(long idleForMs)
Callback when idle.
|
void |
scheduleTimeout(Timeout.Task task,
long timeoutMs) |
void |
scheduleWrite()
Schedule a write dispatch.
|
void |
setCheckForIdle(boolean check)
Set if the endpoint should be checked for idleness
|
void |
setConnection(Connection connection) |
void |
setMaxIdleTime(int timeMs)
Set the max idle time.
|
void |
shutdownInput()
Shutdown any backing input stream associated with the endpoint
|
void |
shutdownOutput()
Shutdown any backing output stream associated with the endpoint
|
public void dispatch()
AsyncEndPoint
dispatch
in interface AsyncEndPoint
public void asyncDispatch()
AsyncEndPoint
asyncDispatch
in interface AsyncEndPoint
public void scheduleWrite()
AsyncEndPoint
scheduleWrite
in interface AsyncEndPoint
public void onIdleExpired(long idleForMs)
AsyncEndPoint
An endpoint is idle if there has been no IO activity for
EndPoint.getMaxIdleTime()
and AsyncEndPoint.isCheckForIdle()
is true.
onIdleExpired
in interface AsyncEndPoint
idleForMs
- TODOpublic void setCheckForIdle(boolean check)
AsyncEndPoint
setCheckForIdle
in interface AsyncEndPoint
public boolean isCheckForIdle()
AsyncEndPoint
isCheckForIdle
in interface AsyncEndPoint
public boolean isWritable()
isWritable
in interface AsyncEndPoint
public boolean hasProgressed()
hasProgressed
in interface AsyncEndPoint
AsyncEndPoint.hasProgressed()
public void scheduleTimeout(Timeout.Task task, long timeoutMs)
scheduleTimeout
in interface AsyncEndPoint
public void cancelTimeout(Timeout.Task task)
cancelTimeout
in interface AsyncEndPoint
public Connection getConnection()
getConnection
in interface ConnectedEndPoint
public void setConnection(Connection connection)
setConnection
in interface ConnectedEndPoint
public void shutdownOutput() throws IOException
EndPoint
shutdownOutput
in interface EndPoint
IOException
public boolean isOutputShutdown()
isOutputShutdown
in interface EndPoint
public void shutdownInput() throws IOException
EndPoint
shutdownInput
in interface EndPoint
IOException
public boolean isInputShutdown()
isInputShutdown
in interface EndPoint
public void close() throws IOException
EndPoint
close
in interface EndPoint
IOException
public int fill(Buffer buffer) throws IOException
EndPoint
fill
in interface EndPoint
int
value indicating the number of bytes
filled or -1 if EOF is reached.EofException
- If input is shutdown or the endpoint is closed.IOException
public int flush(Buffer buffer) throws IOException
EndPoint
flush
in interface EndPoint
buffer
- The buffer to flush. This buffers getIndex is updated.EofException
- If the endpoint is closed or output is shutdown.IOException
public int flush(Buffer header, Buffer buffer, Buffer trailer) throws IOException
EndPoint
flush
in interface EndPoint
header
- A buffer to write before flushing this buffer. This buffers getIndex is updated.buffer
- The buffer to flush. This buffers getIndex is updated.trailer
- A buffer to write after flushing this buffer. This buffers getIndex is updated.IOException
public String getLocalAddr()
getLocalAddr
in interface EndPoint
EndPoint
is bound, or null
if this EndPoint
does not represent a network connection.public String getLocalHost()
getLocalHost
in interface EndPoint
EndPoint
is bound, or null
if this EndPoint
does not represent a network connection.public int getLocalPort()
getLocalPort
in interface EndPoint
EndPoint
is listening, or 0
if this EndPoint
does not represent a network connection.public String getRemoteAddr()
getRemoteAddr
in interface EndPoint
EndPoint
is connected, or null
if this EndPoint
does not represent a network connection.public String getRemoteHost()
getRemoteHost
in interface EndPoint
EndPoint
is connected, or null
if this EndPoint
does not represent a network connection.public int getRemotePort()
getRemotePort
in interface EndPoint
EndPoint
is connected, or 0
if this EndPoint
does not represent a network connection.public boolean isBlocking()
isBlocking
in interface EndPoint
public boolean blockReadable(long millisecs) throws IOException
blockReadable
in interface EndPoint
IOException
public boolean blockWritable(long millisecs) throws IOException
blockWritable
in interface EndPoint
IOException
public Object getTransport()
getTransport
in interface EndPoint
public void flush() throws IOException
EndPoint
flush
in interface EndPoint
EofException
- If the endpoint is closed or output is shutdown.IOException
public int getMaxIdleTime()
EndPoint
The max idle time is the time the endpoint can be idle before
extraordinary handling takes place. This loosely corresponds to
the Socket.getSoTimeout()
for blocking connections,
but AsyncEndPoint
implementations must use other mechanisms
to implement the max idle time.
getMaxIdleTime
in interface EndPoint
public void setMaxIdleTime(int timeMs) throws IOException
EndPoint
setMaxIdleTime
in interface EndPoint
timeMs
- the max idle time in MS. Timeout <= 0 implies an infinite timeoutIOException
- if the timeout cannot be set.Copyright © 1995-2015 Mort Bay Consulting. All Rights Reserved.