Package overit.geocall.util
Class ThreadContext
java.lang.Object
overit.geocall.util.ThreadContext
Collection of method for managing ThreadContext.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CancelListenerprotected Stringprotected static WeakHashMap<ThreadContext, Object> protected HashMapprotected booleanprotected longprotected intprotected HashMapprotected Exceptionprotected longprotected WeakReferenceprotected Tracerprotected booleanprotected Stringprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an additional tracer to the tracer list.voidcancelProcessing(String reason) Method used to cancel the processing of the listenerchangeTracer(Tracer tracer) Replaces the main tracer, if there is one, and stops it.voidenterDeafMode(String reason) Method used to enter the deaf modevoidexitDeafMode(String summary) Method used to exit the deaf modeReturns the description of theCancelListenerReturns the string containing the reason of the cancel requeststatic ThreadContextReturns theThreadContext.ThreadLocalContextstatic ArrayList<ThreadContext> Returns the HashMap containing the criticalslongReturns the end timegetId()Get the identifier of the current thread contextReturns the HashMap containing the max criticalslongReturns the start timeReturns the threadMain tracer extractionAddictional tracer extractionbooleanDeprecated.getUser()Returns the userbooleanReturns if the tracing is habilitatedprotected static voidvoidrelCritical(String critical) Method used to release the criticalbooleanremoveTracer(Tracer tracer) Removes an additional tracer from the tracer list, and stops itvoidreqCritical(String critical) Method used to request the criticalvoidsetCancelListener(CancelListener cancelListener) Sets theCancelListenervoidSets the processing exceptionvoidSets the uservoidstart()Starts tracingvoidstop()Stop the tracestatic voidthreadTrace(String s, Object o) static voidthreadTrace(String s, Object o, boolean stringify) voidvoid
-
Field Details
-
_contexts
-
id
-
_thread
-
_tracers
-
_tracer
-
_tracing
protected boolean _tracing -
_deaf
protected boolean _deaf -
_startTime
protected long _startTime -
_endTime
protected long _endTime -
_lines
protected int _lines -
_user
-
_cancelListener
-
_cancelRequest
-
_processingException
-
_criticals
-
_maxCriticals
-
-
Constructor Details
-
ThreadContext
public ThreadContext()Creates an instance of ThreadContext
-
-
Method Details
-
getContext
Returns theThreadContext.ThreadLocalContext- Returns:
- The
ThreadContext.ThreadLocalContext
-
registerContext
-
getId
Get the identifier of the current thread context- Returns:
- the unique identifier
-
getThread
Returns the thread- Returns:
- The thread
-
start
public void start()Starts tracing -
changeTracer
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
Adds an additional tracer to the tracer list.- Parameters:
tracer- The tracer to be added
-
removeTracer
Removes an additional tracer from the tracer list, and stops it- Parameters:
tracer- The tracer to be removed.- Returns:
trueif the tracer list contained the specified element,falseotherwise
-
trace
-
trace
-
setUser
Sets the user- Parameters:
user- The string containing the user to set
-
getUser
Returns the user- Returns:
- the string containing the user
-
getCriticals
Returns the HashMap containing the criticals- Returns:
- The HashMap containing the criticals
-
getMaxCriticals
Returns the HashMap containing the max criticals- Returns:
- The HashMap containing the max criticals
-
reqCritical
Method used to request the critical- Parameters:
critical- String containing the critical
-
relCritical
Method used to release the critical- Parameters:
critical- String containing the critical
-
setCancelListener
Sets theCancelListener- Parameters:
cancelListener- TheCancelListenerto set
-
cancelProcessing
Method used to cancel the processing of the listener- Parameters:
reason- String containing the reason
-
getCancelListenerDescription
Returns the description of theCancelListener- Returns:
- The description of the
CancelListener
-
getCancelRequestReason
Returns the string containing the reason of the cancel request- Returns:
- The string containing the reason of the cancel request
-
getTracer
Main tracer extraction- Returns:
- The main tracer
-
getTracers
Addictional tracer extraction- Returns:
- The addictional list of tracer
-
stop
public void stop()Stop the trace -
setProcessingException
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.useisTracing()insteadReturns if the tracing is habilitated- Returns:
trueif the tracing is habilitated,falseotherwise
-
isTracing
public boolean isTracing()Returns if the tracing is habilitated- Returns:
trueif the tracing is habilitated,falseotherwise
-
enterDeafMode
Method used to enter the deaf mode- Parameters:
reason- String containing the reason
-
exitDeafMode
Method used to exit the deaf mode- Parameters:
summary- String containing the summary
-
threadTrace
-
threadTrace
-
getContexts
-
isTracing()instead