Class StartEndTracer

java.lang.Object
overit.geocall.util.tracer.MemoryTracer
overit.geocall.util.tracer.StartEndTracer
All Implemented Interfaces:
Serializable, Tracer

public class StartEndTracer extends MemoryTracer implements Serializable
This class extends the abstract class MemoryTracer and creates an instance of the tracer.
This tracer put in the register the first 'n/2' rows and the last 'n/2' rows, where 'n' is the value of the parameter passed to the constructor StartEndTracer(maxSize).
Usually the 'maxSize' corresponds to the value ThreadContext.MAX_MEMORY_TRACE_SIZE.
See Also:
  • Field Details

    • _maxPartSize

      protected int _maxPartSize
    • _head

      protected ArrayList<Object[]> _head
    • _tail

      protected ArrayList<Object[]> _tail
    • _tailStart

      protected int _tailStart
  • Constructor Details

    • StartEndTracer

      public StartEndTracer(int maxSize)
      Class constructor using the first parameter to determine the maximum registry length.
      The maximum length will be splitted in two equals part, so the first rows will be placed in the registry up to half the maximum length and the same thing for the last rows.
      Parameters:
      maxSize - Maximum registry length.
  • Method Details

    • getRegistry

      public ArrayList getRegistry()
      Return the ArrayList called "registry" containing all the records of the log.
      Specified by:
      getRegistry in class MemoryTracer
      Returns:
      The ArrayList contains all the records of the log.
    • record

      public void record(String name, Object val)
      Adds a record of log to the registry.
      Specified by:
      record in interface Tracer
      Parameters:
      name - String contains the name of the record to put in the registry.
      val - The value to put in the registry.
    • stop

      public void stop()
      Method to call when the execution is finished. Takes care of calculating the execution time as a delta between the start and end processing time.
      Specified by:
      stop in interface Tracer
    • getTraceTime

      public long getTraceTime()
      Return the time of the execution. If the stop() has not been called, the value returned will be 0.
      Specified by:
      getTraceTime in interface Tracer
      Returns:
      The time of the execution.