A queue of "events". Each event is a write to the OutputStream.
This class implements both the reader and writer half of the queue.
Each "event" is returned as an OutputStreamEventQueueEntry object.
The "writer" interface is the set of OutputStream calls. This class
extends OutputStream, overriding all the OutputStream methods.
All data written to this object is stored up as "events" in an internal
queue. Each write is a separate event, so sometimes you will get one
event with data followed by one with just a newline. You can pass objects
of this class to anything that expects and OutputStream. Calls to the
OutputStream methods always return immediatly.
You may optionally specify a maximum number of bytes to store. After
each write to the queue, if the new total number of bytes is larger than
this limit, then the oldest entries are discarded until the total is
at or below the limit. This could result in throwing out all the elements
in the queue. Only the number of bytes of data written by the
write() methods is counted, not the additional date
stamping and object encapsulation. If you specify a size limit of
zero, then no limit is imposed.
The "reader" interface is the getEvent() method. Calls to this method
will block until there is an event to return. Readers may also call the
hasEventsPending() method to see if there are any events. This call does
not block.
One possible use for this class is with the PrintTransactionFilter class.
If you pass in an instance of this class as the OutputStream, you may
then fetch the logging data in a convienent way.
See Also: com.lutris.util.OutputStreamEventQueueEntry See Also: java.io.OutputStream See Also: com.lutris.servlet.filter.PrintTransactionFilter author: Andy John |