Class TraceItemDispatcher

  • All Implemented Interfaces:
    java.lang.Runnable

    public class TraceItemDispatcher
    extends java.lang.Object
    implements java.lang.Runnable

    Internal use only.

    .

    A dispatcher for TraceItems

    Version:
    $Revision: 1.8 $
    • Field Detail

      • TIMESTAMP_FORMAT

        private static final java.text.Format TIMESTAMP_FORMAT
      • bufferStatus_

        private static int bufferStatus_
      • cacheMaxSize_

        private int cacheMaxSize_
    • Constructor Detail

      • TraceItemDispatcher

        public TraceItemDispatcher()
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • dumpTraceElement

        private void dumpTraceElement​(TraceItem item)
        Format an item and print it to standard out.
        Parameters:
        item - the item to print.
      • defaultTraceWriter

        private static void defaultTraceWriter​(TraceItem item)
        Provide default behaviour
        Parameters:
        item - The item to print
      • 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.
      • waitForQueueToEmpty

        private void waitForQueueToEmpty()
      • 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​(java.lang.String fieldName,
                                           java.lang.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