qflib 0.98.0

de.qfs.lib.log
Class LogQueue

java.lang.Object
  |
  +--de.qfs.lib.log.LogQueue

public class LogQueue
extends java.lang.Object

This is a queue specialized for LogEntries.

Version:
$Revision: 1.11 $
Author:
Gregor Schmid
See Also:
Log

Inner Class Summary
static class LogQueue.UnitTest
          Test cases for the LogQueue class.
 
Method Summary
 void entriesProcessed()
          Notify the LogQueue that popped entries have been processed and new ones may be accepted.
 int getQueueSize()
          Get the size of the queue where it starts to either block or drop entries.
 boolean isDropOnOverflow()
          Query whether the queue drops entries when it overflows.
 boolean isQueueing()
          Get the queueing state of the LogQueue.
 LogEntry pop()
          Pop an object from the front of the queue.
 LogEntry[] popAll()
          Pop all elements from the Queue.
 void push(LogEntry object)
          Push an object to the back of the queue.
 void setDropOnOverflow(boolean drop)
          Set whether entries should be dropped when the queue overflows.
 void setQueueing(boolean queueing)
          Set the queueing state of the LogQueue.
 void setQueueSize(int newsize)
          Set the maximum size of the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

push

public void push(LogEntry object)
Push an object to the back of the queue.

Parameters:
object - The object being pushed.

pop

public LogEntry pop()
Pop an object from the front of the queue.


popAll

public LogEntry[] popAll()
Pop all elements from the Queue.
Returns:
An array of the queue's elements.

entriesProcessed

public void entriesProcessed()
Notify the LogQueue that popped entries have been processed and new ones may be accepted.

isQueueing

public final boolean isQueueing()
Get the queueing state of the LogQueue.
Returns:
The queueing state of the LogQueue.

setQueueing

public final void setQueueing(boolean queueing)
Set the queueing state of the LogQueue.
Parameters:
queueing - The queueing state to set.

getQueueSize

public final int getQueueSize()
Get the size of the queue where it starts to either block or drop entries.
Returns:
The maximum size of the queue.

setQueueSize

public void setQueueSize(int newsize)
Set the maximum size of the queue.
Parameters:
newsize - The new size of the queue.

isDropOnOverflow

public final boolean isDropOnOverflow()
Query whether the queue drops entries when it overflows.
Returns:
True if the queue drops entries on overflow.

setDropOnOverflow

public void setDropOnOverflow(boolean drop)
Set whether entries should be dropped when the queue overflows. If this is set to false, as is the default, the queue will block when it is full, otherwise it will silently throw away old entries.
Parameters:
drop - Whether entries should be dropped.

qflib 0.98.0