org.e2etrace.trace
Interface ITraceSession

All Known Implementing Classes:
DefaultTraceSession, NoopTraceSession

public interface ITraceSession

A trace session manages all trace steps for a single service call.

The id of a trace session is the id of the root step (see getRootStep). This id can be used to deactivate tracing on a per-session basis (see ITraceConfig).

Author:
Gunther Popp

Method Summary
 void enterStep(Class clazz, String method)
          Wrapper for enterStep(ITraceStepId) using a MethodTraceStepId as TraceStep-IDs.
 void enterStep(ITraceStepId id)
          Enters a new trace step with the supplied id.
 void enterStep(String id)
          Wrapper for enterStep(ITraceStepId) using a String as TraceStep-IDs.
 ITraceConfig getConfig()
          Returns the trace configuration of the session.
 ITraceStep getCurrentStep()
          Returns the active trace step.
 long getDuration()
          Returns the execution time of the complete trace session.
 ITraceStep getRootStep()
          Returns the the root step.
 void leaveStep(Class clazz, String method)
          Wrapper for leaveStep(ITraceStepId) using a MethodTraceStepId as TraceStep-IDs.
 void leaveStep(ITraceStepId id)
          Leaves the trace step with the given id.
 void leaveStep(String id)
          Wrapper for leaveStep(ITraceStepId) using a String as TraceStep-IDs.
 void setConfig(ITraceConfig tc)
          Assigns a new trace configuratio to the trace session.
 

Method Detail

enterStep

void enterStep(ITraceStepId id)
Enters a new trace step with the supplied id.

In reality, a trace step covers for example the execution of a single method. In this case, enterStep must be called when the method starts and leaveStep when the method ends.

To get exact results, each call of enterStep should be matched by a corresponding call of leaveStep. A trace session can handle missing leaveStep calls. In this case, leaveStep will be automatically invoked when the parent step ends (if any). If no parent exists, no duration will be calculated.

Parameters:
id - ID of the trace step

leaveStep

void leaveStep(ITraceStepId id)
Leaves the trace step with the given id.

Parameters:
id - ID of the trace step

enterStep

void enterStep(Class clazz,
               String method)
Wrapper for enterStep(ITraceStepId) using a MethodTraceStepId as TraceStep-IDs.

Parameters:
clazz - Class instance to which the method belongs
method - Name of the executed method

leaveStep

void leaveStep(Class clazz,
               String method)
Wrapper for leaveStep(ITraceStepId) using a MethodTraceStepId as TraceStep-IDs.

Parameters:
clazz - Class instance to which the method belongs
method - Name of the executed method

enterStep

void enterStep(String id)
Wrapper for enterStep(ITraceStepId) using a String as TraceStep-IDs.

Parameters:
id - String used as id

leaveStep

void leaveStep(String id)
Wrapper for leaveStep(ITraceStepId) using a String as TraceStep-IDs.

Parameters:
id - String used as id

getRootStep

ITraceStep getRootStep()
Returns the the root step.

The root step is the step that covers the complete service call (i.e. that has no parent step). The id of the root step is used as id for the complete trace session.

Returns:
root step (null: no trace data has been collected for this session)

getCurrentStep

ITraceStep getCurrentStep()
Returns the active trace step.

The active trace step is determined by the last call to enterStep. If enterStep has not been called yet, the method returns the root step of the trace session (see getRootStep).

Returns:
active trace step (null: no trace data is collected for this session)

getDuration

long getDuration()
Returns the execution time of the complete trace session.

Normally for each service call a separate trace session exist. So the returned duration is the overall execution time of the service call.

Returns:
execution time of the trace session

setConfig

void setConfig(ITraceConfig tc)
Assigns a new trace configuratio to the trace session.

Parameters:
tc - trace configuration

getConfig

ITraceConfig getConfig()
Returns the trace configuration of the session.

Returns:
trace configuration


Copyright © 2013 Gunther Popp. All Rights Reserved.