|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.officefloor.plugin.socket.server.impl.SocketListener<CH>
public class SocketListener<CH extends ConnectionHandler>
Listens to Socket instances.
| Nested Class Summary | |
|---|---|
static class |
SocketListener.SocketListenerDependencies
Keys for the dependencies for the SocketListener. |
| Field Summary | |
|---|---|
static int |
UNBOUNDED_MAX_CONNECTIONS
Value to indicate an unbounded number of Connection instances can
be registered. |
| Constructor Summary | |
|---|---|
SocketListener(SelectorFactory selectorFactory,
Server<CH> server,
int maxCommunications)
Initiate. |
|
| Method Summary | |
|---|---|
Object |
doTask(TaskContext<ConnectionManager<CH>,SocketListener.SocketListenerDependencies,Indexed> context)
|
Object |
getContextObject()
Obtains the context bound object. |
InputBufferStream |
getInputBufferStream()
Obtains the InputBufferStream to read data from the client. |
long |
getTime()
Obtains the current time in milliseconds. |
void |
processRequest(Object attachment)
Flags that the request has been received. |
void |
setCloseConnection(boolean isClose)
Flags to close the Connection. |
void |
setContextObject(Object contextObject)
Specifies the context bound object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int UNBOUNDED_MAX_CONNECTIONS
Connection instances can
be registered.
| Constructor Detail |
|---|
public SocketListener(SelectorFactory selectorFactory,
Server<CH> server,
int maxCommunications)
selectorFactory - SelectorFactory.server - Server.maxCommunications - Maximum number of Connection instances that can be
registered with this SocketListener.| Method Detail |
|---|
public Object doTask(TaskContext<ConnectionManager<CH>,SocketListener.SocketListenerDependencies,Indexed> context)
throws Exception
doTask in interface Task<ConnectionManager<CH extends ConnectionHandler>,SocketListener.SocketListenerDependencies,Indexed>Exceptionpublic void setCloseConnection(boolean isClose)
ConnectionHandlerContextConnection.
setCloseConnection in interface ConnectionHandlerContextisClose - true to close the Connection.public long getTime()
ConnectionHandlerContextObtains the current time in milliseconds.
This should return similar to System.currentTimeMillis() but is
provided to cache time for multiple quick operations that require only
estimates of time.
Note CPU operations should be in the nanoseconds.
getTime in interface ConnectionHandlerContextpublic Object getContextObject()
ConnectionHandlerContext
getContextObject in interface ConnectionHandlerContextpublic void setContextObject(Object contextObject)
ConnectionHandlerContext
setContextObject in interface ConnectionHandlerContextcontextObject - Context bound object.public InputBufferStream getInputBufferStream()
ReadContextInputBufferStream to read data from the client.
getInputBufferStream in interface ReadContextInputBufferStream.
public void processRequest(Object attachment)
throws IOException
ReadContextServer process the request.
processRequest in interface ReadContextattachment - Optional attachment for the request. May be null.
IOException - If fails to process request.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||