Class ThreadContext

java.lang.Object
overit.geocall.util.ThreadContext

public class ThreadContext extends Object
Collection of method for managing ThreadContext.
  • Field Details

    • _contexts

      protected static WeakHashMap<ThreadContext,Object> _contexts
    • id

      protected String id
    • _thread

      protected WeakReference _thread
    • _tracers

      protected ArrayList<Tracer> _tracers
    • _tracer

      protected Tracer _tracer
    • _tracing

      protected boolean _tracing
    • _deaf

      protected boolean _deaf
    • _startTime

      protected long _startTime
    • _endTime

      protected long _endTime
    • _lines

      protected int _lines
    • _user

      protected String _user
    • _cancelListener

      protected CancelListener _cancelListener
    • _cancelRequest

      protected String _cancelRequest
    • _processingException

      protected Exception _processingException
    • _criticals

      protected HashMap _criticals
    • _maxCriticals

      protected HashMap _maxCriticals
  • Constructor Details

    • ThreadContext

      public ThreadContext()
      Creates an instance of ThreadContext
  • Method Details

    • getContext

      public static ThreadContext getContext()
      Returns the ThreadContext.ThreadLocalContext
      Returns:
      The ThreadContext.ThreadLocalContext
    • registerContext

      protected static void registerContext(ThreadContext tc)
    • getId

      public String getId()
      Get the identifier of the current thread context
      Returns:
      the unique identifier
    • getThread

      public Thread getThread()
      Returns the thread
      Returns:
      The thread
    • start

      public void start()
      Starts tracing
    • changeTracer

      public Tracer changeTracer(Tracer tracer)
      Replaces the main tracer, if there is one, and stops it.
      Parameters:
      tracer - The substitute tracer
      Returns:
      Null if there is no tracer, otherwise the current tracer
    • addTracer

      public void addTracer(Tracer tracer)
      Adds an additional tracer to the tracer list.
      Parameters:
      tracer - The tracer to be added
    • removeTracer

      public boolean removeTracer(Tracer tracer)
      Removes an additional tracer from the tracer list, and stops it
      Parameters:
      tracer - The tracer to be removed.
      Returns:
      true if the tracer list contained the specified element, false otherwise
    • trace

      public void trace(String name, Object val)
    • trace

      public void trace(String name, Object val, boolean stringify)
    • setUser

      public void setUser(String user)
      Sets the user
      Parameters:
      user - The string containing the user to set
    • getUser

      public String getUser()
      Returns the user
      Returns:
      the string containing the user
    • getCriticals

      public HashMap getCriticals()
      Returns the HashMap containing the criticals
      Returns:
      The HashMap containing the criticals
    • getMaxCriticals

      public HashMap getMaxCriticals()
      Returns the HashMap containing the max criticals
      Returns:
      The HashMap containing the max criticals
    • reqCritical

      public void reqCritical(String critical)
      Method used to request the critical
      Parameters:
      critical - String containing the critical
    • relCritical

      public void relCritical(String critical)
      Method used to release the critical
      Parameters:
      critical - String containing the critical
    • setCancelListener

      public void setCancelListener(CancelListener cancelListener)
      Parameters:
      cancelListener - The CancelListener to set
    • cancelProcessing

      public void cancelProcessing(String reason)
      Method used to cancel the processing of the listener
      Parameters:
      reason - String containing the reason
    • getCancelListenerDescription

      public String getCancelListenerDescription()
      Returns the description of the CancelListener
      Returns:
      The description of the CancelListener
    • getCancelRequestReason

      public String getCancelRequestReason()
      Returns the string containing the reason of the cancel request
      Returns:
      The string containing the reason of the cancel request
    • getTracer

      public Tracer getTracer()
      Main tracer extraction
      Returns:
      The main tracer
    • getTracers

      public ArrayList<Tracer> getTracers()
      Addictional tracer extraction
      Returns:
      The addictional list of tracer
    • stop

      public void stop()
      Stop the trace
    • setProcessingException

      public void setProcessingException(Exception e)
      Sets the processing exception
      Parameters:
      e - The exception to set
    • getStartTime

      public long getStartTime()
      Returns the start time
      Returns:
      The start time
    • getEndTime

      public long getEndTime()
      Returns the end time
      Returns:
      The end time
    • getTracing

      @Deprecated public boolean getTracing()
      Deprecated.
      use isTracing() instead
      Returns if the tracing is habilitated
      Returns:
      true if the tracing is habilitated, false otherwise
    • isTracing

      public boolean isTracing()
      Returns if the tracing is habilitated
      Returns:
      true if the tracing is habilitated, false otherwise
    • enterDeafMode

      public void enterDeafMode(String reason)
      Method used to enter the deaf mode
      Parameters:
      reason - String containing the reason
    • exitDeafMode

      public void exitDeafMode(String summary)
      Method used to exit the deaf mode
      Parameters:
      summary - String containing the summary
    • threadTrace

      public static void threadTrace(String s, Object o)
    • threadTrace

      public static void threadTrace(String s, Object o, boolean stringify)
    • getContexts

      public static ArrayList<ThreadContext> getContexts()