net.wgen.op.logging
Class TraceKey

java.lang.Object
  extended bynet.wgen.op.logging.TraceKey
All Implemented Interfaces:
java.io.Serializable

public final class TraceKey
extends java.lang.Object
implements java.io.Serializable

Relates operations in some chain of events as belonging to the same source event and aggregates stats on what has happened during the lifetime of the trace.

Version:
$Id: TraceKey.html,v 1.2 2007/01/28 04:09:37 paulfeuer Exp $
Author:
Paul Feuer, Wireless Generation, Inc.
See Also:
Serialized Form

Field Summary
private  long _counter
          A counter to distinguish among requests.
private  RequestExecutionInfo _execInfo
          Accumulated information about things that have happened during the trace.
private  java.lang.Object _localMarker
          In a distributed EJB environment, this transient object is used to identify whether or not the TraceKey has been serialized across the network.
private  OpModule _module
          The module claiming this trace, either determined by the url or class, or explicitly passed into the constructor.
private  java.lang.String _requestUrl
          The requested url if available.
private  long _startTime
          The start time of the trace.
private  SubModule _subModule
          A sub module if there is one.
private  boolean _temporary
          Whether or not this trace is considered temporary because of some legacy operation that is being done with out a TraceKey.
protected  java.lang.String _toStringRepresentation
          The string representation of the traceKey generated in the constructor for use by toString.
private  TraceState _traceState
           
private  java.lang.String _tracingLoggerRoot
          If tracing is on, the TraceTriggerState will set the logging root, under which it tries to append the TraceLogger.
private  boolean _tracingOn
          Whether or not tracing is deemed to be on.
private  java.util.Map _userData
          A spot to store user data that follows the trace.
private  java.lang.Long _userId
          The current user during the trace, or 0 if there is no userSid available.
private static long serialVersionUID
           
protected static java.lang.String TEMPORARY_NAME
           
 
Constructor Summary
protected TraceKey(long startTime, java.lang.Long userId, OpModule module, SubModule subModule, java.lang.String requestUrl, long counter)
          The typical constructor where the url will be claimed by some application.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 void finishUsingTempKey()
          In the legacy context (ModelManager), a temporary key is used to aggregate information, and then before being kicked out is dumped, and this logs the collected stats to the stat log.
 long getCounter()
           
 RequestExecutionInfo getExecInfo()
           
 java.lang.Object getLocalMarker()
          In a distributed EJB environment, the EjbOpExecutor uses the localMarker on either side of the EJB call to determine whether or not the Op had been serialized during the EJB call.
 OpModule getModule()
           
 java.lang.String getRequestUrl()
           
 long getStartTime()
           
 SubModule getSubModule()
           
 java.lang.String getToStringRepresentation()
           
 TraceState getTraceState()
           
 java.lang.String getTracingLoggerRoot()
           
 java.util.Map getUserData()
           
 java.lang.Long getUserId()
           
 int hashCode()
           
 boolean isTemporary()
           
 boolean isTracingOn()
          Whether or not the TraceTrigger identified this request as tracing.
protected  java.lang.String makeToString()
           
protected  void setTraceState(TraceState traceState)
           
protected  void setTracingLoggerRoot(java.lang.String tracingLoggerRoot)
           
protected  void setTracingOn()
          Set by the TraceTrigger, this identifies whether or not a Logger has been added to collect trace statements.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

TEMPORARY_NAME

protected static final java.lang.String TEMPORARY_NAME
See Also:
Constant Field Values

_startTime

private final long _startTime
The start time of the trace.


_userId

private final java.lang.Long _userId
The current user during the trace, or 0 if there is no userSid available.


_requestUrl

private final java.lang.String _requestUrl
The requested url if available.


_counter

private final long _counter
A counter to distinguish among requests.


_toStringRepresentation

protected final java.lang.String _toStringRepresentation
The string representation of the traceKey generated in the constructor for use by toString.


_userData

private java.util.Map _userData
A spot to store user data that follows the trace.


_module

private final OpModule _module
The module claiming this trace, either determined by the url or class, or explicitly passed into the constructor.


_subModule

private final SubModule _subModule
A sub module if there is one.


_execInfo

private final RequestExecutionInfo _execInfo
Accumulated information about things that have happened during the trace.


_tracingOn

private boolean _tracingOn
Whether or not tracing is deemed to be on.


_temporary

private final boolean _temporary
Whether or not this trace is considered temporary because of some legacy operation that is being done with out a TraceKey.


_localMarker

private transient java.lang.Object _localMarker
In a distributed EJB environment, this transient object is used to identify whether or not the TraceKey has been serialized across the network.


_tracingLoggerRoot

private java.lang.String _tracingLoggerRoot
If tracing is on, the TraceTriggerState will set the logging root, under which it tries to append the TraceLogger.


_traceState

private transient TraceState _traceState
Constructor Detail

TraceKey

protected TraceKey(long startTime,
                   java.lang.Long userId,
                   OpModule module,
                   SubModule subModule,
                   java.lang.String requestUrl,
                   long counter)
The typical constructor where the url will be claimed by some application.

Parameters:
startTime - the initialization time of the trace
userId - the sid of the user or 0 if there is no user id available
module -
subModule -
requestUrl - the requested url to be claimed by an application
counter - a counter to differentiate simultaneous requests from the same user
Method Detail

getUserData

public java.util.Map getUserData()

getStartTime

public long getStartTime()

getUserId

public java.lang.Long getUserId()

getRequestUrl

public java.lang.String getRequestUrl()

getCounter

public long getCounter()

getModule

public OpModule getModule()

getSubModule

public SubModule getSubModule()

getExecInfo

public RequestExecutionInfo getExecInfo()

getToStringRepresentation

public java.lang.String getToStringRepresentation()

getLocalMarker

public java.lang.Object getLocalMarker()
In a distributed EJB environment, the EjbOpExecutor uses the localMarker on either side of the EJB call to determine whether or not the Op had been serialized during the EJB call.

Returns:
the transient marker identifying
See Also:
EjbOpExecutor.executeOp(net.wgen.op.Op), OpManagerBean.executeOp(net.wgen.op.Op)

isTracingOn

public boolean isTracingOn()
Whether or not the TraceTrigger identified this request as tracing.

Returns:
whether or not the TraceFilter identified this request as tracing
See Also:
TraceTrigger.handleTriggerValue(net.wgen.op.http.filter.ParamTrigger, String, Object, net.wgen.op.http.filter.ParamTriggerState)

setTracingOn

protected void setTracingOn()
Set by the TraceTrigger, this identifies whether or not a Logger has been added to collect trace statements. This method is used in conjunction with other operations to ensure that the trace logger is initialized. By itself, outside of that invocation by the TraceFilter, this does not

See Also:
TraceTrigger.handleTriggerValue(net.wgen.op.http.filter.ParamTrigger, String, Object, net.wgen.op.http.filter.ParamTriggerState)

getTraceState

public TraceState getTraceState()

setTraceState

protected void setTraceState(TraceState traceState)

getTracingLoggerRoot

public java.lang.String getTracingLoggerRoot()

setTracingLoggerRoot

protected void setTracingLoggerRoot(java.lang.String tracingLoggerRoot)

isTemporary

public boolean isTemporary()

finishUsingTempKey

public void finishUsingTempKey()
In the legacy context (ModelManager), a temporary key is used to aggregate information, and then before being kicked out is dumped, and this logs the collected stats to the stat log.


makeToString

protected java.lang.String makeToString()

toString

public java.lang.String toString()

equals

public boolean equals(java.lang.Object o)

hashCode

public int hashCode()