|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.lang.Thread
|
+--nu.dll.io.QueuedSender
Experimental class that handles asynchronous sending of Message objects
to different ObjectOutputStreams. When using the enqueue() methods, this
class has a 200 ms delay before actually writing the data to the streams.
flush() can be called to force the data to be written
immediately.
When broadcasting identical messages to a list of clients, or when sending
a bulk of several messages to one client, one of the enqueueAll() may
be used to ensure efficient bulk sending.
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
QueuedSender()
Creates a queued sender with no default output stream. |
|
QueuedSender(java.io.ObjectOutputStream stream)
Creates a queued sender with a default output stram. |
|
QueuedSender(java.io.ObjectOutputStream stream,
java.util.List queue)
Creates a queued sender with a default output stream and using the specified List as a queue. |
|
| Method Summary | |
void |
enqueue(Message m)
Enqueues the supplies messages to be written to the default output stream. |
void |
enqueue(java.io.ObjectOutputStream istream,
Message m)
Enqueues the supplied message to be written to the supplied output stream. |
void |
enqueueAll(java.lang.Object[] istream,
Message message)
Enqueues the supplied message to all the given output streams. |
void |
enqueueAll(java.io.ObjectOutputStream istream,
java.lang.Object[] messages)
Enqueues all supplied messages to the given outputstream. |
void |
flush()
Causes the sender to write all pending messages to their destinations, unless it isn't already doing so. |
void |
halt()
Causes the thread to terminate as soon as it has written the remaining objects on its queue to their streams. |
void |
run()
Runs until halt() is called or the thread is interrupted. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public QueuedSender()
public QueuedSender(java.io.ObjectOutputStream stream)
public QueuedSender(java.io.ObjectOutputStream stream,
java.util.List queue)
| Method Detail |
public void run()
run in class java.lang.Threadpublic void halt()
public void enqueueAll(java.io.ObjectOutputStream istream,
java.lang.Object[] messages)
public void enqueueAll(java.lang.Object[] istream,
Message message)
public void enqueue(java.io.ObjectOutputStream istream,
Message m)
public void enqueue(Message m)
java.lang.IllegalStateException - thrown if this sender lacks a default output streampublic void flush()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||