com.gargoylesoftware.base.trace
Class TraceItemDispatcher

java.lang.Object
  extended bycom.gargoylesoftware.base.trace.TraceItemDispatcher
All Implemented Interfaces:
Runnable

public class TraceItemDispatcher
extends Object
implements Runnable

Internal use only.

.

A dispatcher for TraceItems

Version:
$Revision: 1.9 $
Author:
Mike Bowler

Constructor Summary
TraceItemDispatcher()
           
 
Method Summary
protected  void assertNotNull(String fieldName, Object fieldValue)
          Verify that the specified value is not null.
 void dispatch(TraceItem item)
          Add an item to the trace queue.
 void disposeTraceItem(TraceItem item)
          Dispose of a trace item.
 void flush()
           
 TraceItem getNewTraceItem()
          Return a trace item
 TraceItemQueue getTraceItemQueue()
          Get the queue.
 boolean isBufferingEnabled()
          Return true if buffering is enabled.
 void run()
           
 void setBufferingEnabled(boolean enabled)
          Set whether or not to buffer the output of the trace calls.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TraceItemDispatcher

public TraceItemDispatcher()
Method Detail

run

public void run()
Specified by:
run in interface Runnable

getTraceItemQueue

public TraceItemQueue getTraceItemQueue()
Get the queue.

Returns:
The queue.

dispatch

public void dispatch(TraceItem item)
Add an item to the trace queue.

Parameters:
item - The item to add.

setBufferingEnabled

public void setBufferingEnabled(boolean enabled)
Set whether or not to buffer the output of the trace calls. Buffering will increase perceived performance significantly.

Parameters:
enabled - True if buffering should be enabled

isBufferingEnabled

public boolean isBufferingEnabled()
Return true if buffering is enabled.

Returns:
true if buffering is enabled.

flush

public void flush()

getNewTraceItem

public TraceItem getNewTraceItem()
Return a trace item

Returns:
The new trace item.

disposeTraceItem

public void disposeTraceItem(TraceItem item)
Dispose of a trace item. Disposing will put the trace item back on a queue for reuse.

Parameters:
item - The item to dispose.

assertNotNull

protected final void assertNotNull(String fieldName,
                                   Object fieldValue)
                            throws DetailedNullPointerException
Verify that the specified value is not null. If it is then throw an exception

Parameters:
fieldName - The name of the field to check
fieldValue - The value of the field to check
Throws:
DetailedNullPointerException - If fieldValue is null


Copyright © 1998-2005 Gargoyle Software Inc.. All Rights Reserved.