|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
net.sf.colossus.webserver.QueuedSocketWriter
class QueuedSocketWriter
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
private boolean |
done
|
private boolean |
flushed
Set to true when flushing is completed. |
private java.lang.Object |
flushMutex
Sending thread that requests the flushing, waits on this mutex until notified that the flush was completed (boolean 'flushed' below set to true). |
private int |
instanceId
|
private static int |
instanceIdCounter
|
(package private) static java.util.logging.Logger |
LOGGER
|
private static java.lang.String |
MSG_EXIT_LOOP
|
private static java.lang.String |
MSG_FLUSH_MSGS
|
(package private) java.io.PrintWriter |
out
The actual writer object which will send printed data over the socket. |
private java.util.concurrent.LinkedBlockingQueue<java.lang.String> |
queue
The actual queue holding all messages that need to be sent. |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
QueuedSocketWriter(java.net.Socket socket)
|
Method Summary | |
---|---|
void |
flushMessages()
Enqueues a flush marker and waits on the mutex until the flushing of all messages enqueued prior to the marker have been sent. |
private java.lang.String |
readNextFromQueue()
We use no timeout while waiting for next message in the queue. |
void |
run()
|
void |
sendMessage(java.lang.String message)
|
void |
stopWriter()
|
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static final java.util.logging.Logger LOGGER
private static final java.lang.String MSG_EXIT_LOOP
private static final java.lang.String MSG_FLUSH_MSGS
private final java.util.concurrent.LinkedBlockingQueue<java.lang.String> queue
java.io.PrintWriter out
private final java.lang.Object flushMutex
private boolean flushed
private boolean done
private static int instanceIdCounter
private final int instanceId
Constructor Detail |
---|
public QueuedSocketWriter(java.net.Socket socket) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void flushMessages()
public void stopWriter()
public void sendMessage(java.lang.String message)
private java.lang.String readNextFromQueue()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |