|
TopoWeb Commons API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.topoweb.net.server.SessionWriter
An org.topoweb.util.concurrent.SingleRun that writes to
sockets. Receives new Sessions from a queue and registers
them with an internally managed selector that detects the readiness of
sockets for write operations.
run in a single thread and then only once.
| Field Summary | |
protected static java.util.logging.Logger |
LOGGER
The logger used to log messages. |
| Constructor Summary | |
SessionWriter(org.topoweb.util.concurrent.Takable writePendingQueue,
org.topoweb.util.concurrent.Puttable readPendingQueue,
SessionFilter nextReadFilter,
SessionPool sessionPool)
Creates a new instance with the given parameters. |
|
| Method Summary | |
protected boolean |
enqueue(Session session)
Enqueue's the given session in the read-completed
queue. |
void |
init()
Initializes the instance. |
boolean |
isAlive()
|
void |
join(int timeout)
|
void |
run()
Runs the session reader loop. |
void |
stop()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final java.util.logging.Logger LOGGER
| Constructor Detail |
public SessionWriter(org.topoweb.util.concurrent.Takable writePendingQueue,
org.topoweb.util.concurrent.Puttable readPendingQueue,
SessionFilter nextReadFilter,
SessionPool sessionPool)
throws java.lang.IllegalArgumentException
writePendingQueue - the queue from which "write-pending"
Sessions arrivereadPendingQueue - the queue on which Sessions
are sent if the client is allowed another
requestnextReadFilter - the filter used to decide whether any given
Session should be scheduled for
another requestsessionPool - the pool to which cancelled Session
instances are returned
java.lang.IllegalArgumentException - if any of the arguments is null| Method Detail |
public void init()
throws java.lang.IllegalStateException,
java.io.IOException
java.lang.IllegalStateException - if this method has already been invoked
java.io.IOException - if an I/O error occurs
public void run()
throws java.lang.IllegalStateException
run in interface org.topoweb.util.concurrent.SingleRunjava.lang.IllegalStateException - if the instance was not first
initialized; if invoked
more than onceinit(),
stop()
public void stop()
throws java.lang.IllegalStateException
stop in interface org.topoweb.util.concurrent.SingleRunjava.lang.IllegalStateExceptionpublic boolean isAlive()
isAlive in interface org.topoweb.util.concurrent.SingleRun
public void join(int timeout)
throws java.lang.InterruptedException
join in interface org.topoweb.util.concurrent.SingleRunjava.lang.InterruptedExceptionprotected boolean enqueue(Session session)
session in the read-completed
queue. The basic implementation waits roughly 1 second for the queue
operation to succeed.
session - the session to be enqueued
true, if successfully enqueued;
false, o.w.
|
TopoWeb Commons API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||