Copyright @ 2001 SAP. All Rights Reserved.

com.sap.util.monitor.jarm
Class TaskMonitor

java.lang.Object
  |
  +--com.sap.util.monitor.jarm.TaskMonitor
All Implemented Interfaces:
IMonitor

public class TaskMonitor
extends java.lang.Object
implements IMonitor

The class TaskMonitor provides all the methods you need to get your JAVA code monitored.

There is a static methods ( getRequestMonitor ) to get a monitoring object. TaskMonitor implements the API specified by com.sap.util.monitor.jarm.IMonitor to pass information to the monitor object.

See Also:
IMonitor

Method Summary
 void compAction(int compLevel, java.lang.String compName, java.lang.String action)
          Indicates a specific action of a component.
The method is executed only if compLevel is lower or equal the current component monitoring level.
 void compAction(java.lang.String compName, java.lang.String action)
          Indicates a specific action of a component.
Component monitor level = 0 (ConfMonitor.COMPLEVELBASIC)
 void endComponent(int compLevel, java.lang.String compName)
          Indicates the end of a component.
The method is executed only if compLevel is lower or equal the current component monitoring level.
 void endComponent(int compLevel, java.lang.String compName, int dataLength)
          same functionality than endComponent(String); additionally the amount of data which is returned by the component is provided.
The method is executed only if compLevel is lower or equal the current component monitoring level.
 void endComponent(int compLevel, java.lang.String compName, int dataLength, java.lang.Object compProps)
          same functionality than endComponent(String, int); additionally component specific properties are provided.
the component specific properties could only be handled if the parameter jarm/comp/properties/switch=on (default) and if there is there is an implementation of ICompProperties for this component provided The method is executed only if compLevel is lower or equal the current component monitoring level.
 void endComponent(int compLevel, java.lang.String compName, java.lang.Object compProps)
          same functionality than endComponent(String); additionally component specific properties are provided.
the component specific properties could only be handled if the parameter jarm/comp/properties/switch=on (default) and if there is there is an implementation of ICompProperties for this component provided.
The method is executed only if compLevel is lower or equal the current component monitoring level.
 void endComponent(java.lang.String compName)
          Indicates the end of a component.
Component monitor level = 0 (ConfMonitor.COMPLEVELBASIC)
 void endComponent(java.lang.String compName, int dataLength)
          same functionality than endComponent(String); additionally the amount of data which is returned by the component is provided
Component monitor level = 0 (ConfMonitor.COMPLEVELBASIC)
 void endComponent(java.lang.String compName, int dataLength, java.lang.Object compProps)
          same functionality than endComponent(String, int); additionally component specific properties are provided
the component specific properties could only be handled if the parameter jarm/comp/properties/switch=on (default) and if there is there is an implementation of ICompProperties for this component provided
Component monitor level = 0 (ConfMonitor.COMPLEVELBASIC)
 void endComponent(java.lang.String compName, java.lang.Object compProps)
          same functionality than endComponent(String); additionally component specific properties are provided
the component specific properties could only be handled if the parameter jarm/comp/properties/switch=on (default) and if there is there is an implementation of ICompProperties for this component provided
Component monitor level = 0 (ConfMonitor.COMPLEVELBASIC)
 RequestOverview endRequest(int retOverview, java.lang.String reqName)
          same functionality than endRequest(reqName); additionally the collected data for the request is returned if retOverview not equal ConfMonitor.REQOVERVIEWNONE
 RequestOverview endRequest(int retOverview, java.lang.String reqName, int dataLength)
          same functionality than endRequest(String reqName, int dataLength); additionally the collected data for the request is returned
 void endRequest(java.lang.String reqName)
          if the name of the current request is identical to reqName the request is closed; otherwise the call is skipped.
 void endRequest(java.lang.String reqName, int dataLength)
          same functionality than endRequest(String reqName); additionally the amount of data which is returned by the request is provided
 int getComponentLevel()
          The component level for the request is returned.
 boolean getMonitorSwitch()
          Indicates whether monitoring is switched on or off for this request
 java.lang.String getReqName()
          Delivers the name of the request
 long getReqTS()
          Delivers the start timestamp of the request
static IMonitor getRequestMonitor(java.lang.String userName, java.lang.String reqName)
          Returns the monitor object of the current thread (created by a former getRequestMonitor() call); if there was not such a call a new monitoring object is created (userName and reqName is only used in this case); It is recommended to pass a monitor object through other layers of the application because this would save getRequestMonitor() calls;
 boolean getTraceSwitch()
          Indicates whether tracing is switched on or off for this request
 java.lang.String getUser()
          Delivers the user name of the request
 boolean isJarmActiveForRequest()
          Indicates whether monitoring or tracing is switched on or off for this request
 void setComponentLevel(int compLevel)
          The component monitor level for the request is set.
The level could only be set right at the beginning of a request before the first component is started.
 void setDescription(java.lang.String descr)
          Set description for request (text string); if the description is already set for the request it could not be overwritten
 void setUser(java.lang.String userName)
          If the user name was not known when the request was started it could be set by this call afterwards; if a user name is already bound to the request the call is skipped
 void startComponent(int compLevel, java.lang.String compName)
          Indicates the start of a component.
The method is executed only if compLevel is lower or equal the current component monitoring level.
 void startComponent(java.lang.String compName)
          Indicates the start of a component.
Component monitor level = 0 (ConfMonitor.COMPLEVELBASIC)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRequestMonitor

public static IMonitor getRequestMonitor(java.lang.String userName,
                                         java.lang.String reqName)
Returns the monitor object of the current thread (created by a former getRequestMonitor() call); if there was not such a call a new monitoring object is created (userName and reqName is only used in this case);

It is recommended to pass a monitor object through other layers of the application because this would save getRequestMonitor() calls;

Parameters:
userName - user name.
reqName - logical name of the request.
Returns:
current monitor object for subsequent calls or new one if no request was open; if monitoring is switched off a dummy object is returned which could be used like a regular monitor object

endRequest

public void endRequest(java.lang.String reqName)
if the name of the current request is identical to reqName the request is closed; otherwise the call is skipped.
Specified by:
endRequest in interface IMonitor
Parameters:
reqName - logical name of the request

endRequest

public void endRequest(java.lang.String reqName,
                       int dataLength)
same functionality than endRequest(String reqName); additionally the amount of data which is returned by the request is provided
Specified by:
endRequest in interface IMonitor
Parameters:
reqName - logical name of the request
dataLength - amount of data in bytes which is returned from request
See Also:
endRequest(String)

endRequest

public RequestOverview endRequest(int retOverview,
                                  java.lang.String reqName)
same functionality than endRequest(reqName); additionally the collected data for the request is returned if retOverview not equal ConfMonitor.REQOVERVIEWNONE
Specified by:
endRequest in interface IMonitor
Parameters:
retOverview - ConfMonitor.REQOVERVIEWALL <-> return all collected monitoring data; ConfMonitor.REQOVERVIEWNONE <-> 'null' is returned ConfMonitor.REQOVERVIEWHEADER <-> only heeader information is returned, but no data about tasks or single components
reqName - logical name of the request
Returns:
monitor data collected for this request or 'null' if retOverview = ConfMonitor.REQOVERVIEWNONE, monitoring is switched off or reqName doesn't match the current request name
See Also:
endRequest(String)

endRequest

public RequestOverview endRequest(int retOverview,
                                  java.lang.String reqName,
                                  int dataLength)
same functionality than endRequest(String reqName, int dataLength); additionally the collected data for the request is returned
Specified by:
endRequest in interface IMonitor
Parameters:
retOverview - ConfMonitor.REQOVERVIEWALL <-> return all collected monitoring data; ConfMonitor.REQOVERVIEWNONE <-> 'null' is returned ConfMonitor.REQOVERVIEWHEADER <-> only heeader information is returned, but no data about tasks or single components
reqName - logical name of the request
dataLength - amount of data in bytes which is returned from request
Returns:
monitor data collected for this request or 'null' if retOverview = ConfMonitor.REQOVERVIEWNONE, monitoring is switched off or reqName doesn't match the current request name
See Also:
endRequest(String, int)

startComponent

public void startComponent(java.lang.String compName)
Indicates the start of a component.
Component monitor level = 0 (ConfMonitor.COMPLEVELBASIC)
Specified by:
startComponent in interface IMonitor
Parameters:
compName - logical name of the current component.

startComponent

public void startComponent(int compLevel,
                           java.lang.String compName)
Indicates the start of a component.
The method is executed only if compLevel is lower or equal the current component monitoring level.
Specified by:
startComponent in interface IMonitor
Parameters:
compLevel - component monitor level; 0 (ConfMonitor.COMPLEVELBASIC), 1 (ConfMonitor.COMPLEVELMEDIUM), 2 (ConfMonitor.COMPLEVELDETAIL.
compName - logical name of the current component.

endComponent

public void endComponent(java.lang.String compName)
Indicates the end of a component.
Component monitor level = 0 (ConfMonitor.COMPLEVELBASIC)
Specified by:
endComponent in interface IMonitor
Parameters:
compName - logical name of the current component.

endComponent

public void endComponent(java.lang.String compName,
                         int dataLength)
same functionality than endComponent(String); additionally the amount of data which is returned by the component is provided
Component monitor level = 0 (ConfMonitor.COMPLEVELBASIC)
Specified by:
endComponent in interface IMonitor
Parameters:
dataLength - amount of data in bytes which is returned by the component
See Also:
endComponent(String)

endComponent

public void endComponent(java.lang.String compName,
                         java.lang.Object compProps)
same functionality than endComponent(String); additionally component specific properties are provided
the component specific properties could only be handled if the parameter jarm/comp/properties/switch=on (default) and if there is there is an implementation of ICompProperties for this component provided
Component monitor level = 0 (ConfMonitor.COMPLEVELBASIC)
Specified by:
endComponent in interface IMonitor
Parameters:
compName - logical name of the current component.
compProps - component specific properties

endComponent

public void endComponent(java.lang.String compName,
                         int dataLength,
                         java.lang.Object compProps)
same functionality than endComponent(String, int); additionally component specific properties are provided
the component specific properties could only be handled if the parameter jarm/comp/properties/switch=on (default) and if there is there is an implementation of ICompProperties for this component provided
Component monitor level = 0 (ConfMonitor.COMPLEVELBASIC)
Specified by:
endComponent in interface IMonitor
Parameters:
compName - logical name of the current component.
dataLength - amount of data in bytes which is returned by the component
compProps - component specific properties

endComponent

public void endComponent(int compLevel,
                         java.lang.String compName)
Indicates the end of a component.
The method is executed only if compLevel is lower or equal the current component monitoring level.
Specified by:
endComponent in interface IMonitor
Parameters:
compLevel - component monitor level; 0 (ConfMonitor.COMPLEVELBASIC), 1 (ConfMonitor.COMPLEVELMEDIUM), 2 (ConfMonitor.COMPLEVELDETAIL.
compName - logical name of the current component.

endComponent

public void endComponent(int compLevel,
                         java.lang.String compName,
                         int dataLength)
same functionality than endComponent(String); additionally the amount of data which is returned by the component is provided.
The method is executed only if compLevel is lower or equal the current component monitoring level.
Specified by:
endComponent in interface IMonitor
Parameters:
compLevel - component monitor level; 0 (ConfMonitor.COMPLEVELBASIC), 1 (ConfMonitor.COMPLEVELMEDIUM), 2 (ConfMonitor.COMPLEVELDETAIL.
compName - logical name of the current component.
dataLength - amount of data in bytes which is returned by the component
See Also:
endComponent(String)

endComponent

public void endComponent(int compLevel,
                         java.lang.String compName,
                         java.lang.Object compProps)
same functionality than endComponent(String); additionally component specific properties are provided.
the component specific properties could only be handled if the parameter jarm/comp/properties/switch=on (default) and if there is there is an implementation of ICompProperties for this component provided.
The method is executed only if compLevel is lower or equal the current component monitoring level.
Specified by:
endComponent in interface IMonitor
Parameters:
compLevel - component monitor level; 0 (ConfMonitor.COMPLEVELBASIC), 1 (ConfMonitor.COMPLEVELMEDIUM), 2 (ConfMonitor.COMPLEVELDETAIL.
compName - logical name of the current component.
compProps - component specific properties

endComponent

public void endComponent(int compLevel,
                         java.lang.String compName,
                         int dataLength,
                         java.lang.Object compProps)
same functionality than endComponent(String, int); additionally component specific properties are provided.
the component specific properties could only be handled if the parameter jarm/comp/properties/switch=on (default) and if there is there is an implementation of ICompProperties for this component provided The method is executed only if compLevel is lower or equal the current component monitoring level.
Specified by:
endComponent in interface IMonitor
Parameters:
compLevel - component monitor level; 0 (ConfMonitor.COMPLEVELBASIC), 1 (ConfMonitor.COMPLEVELMEDIUM), 2 (ConfMonitor.COMPLEVELDETAIL.
compName - logical name of the current component.
dataLength - amount of data in bytes which is returned by the component
compProps - component specific properties

compAction

public void compAction(java.lang.String compName,
                       java.lang.String action)
Indicates a specific action of a component.
Component monitor level = 0 (ConfMonitor.COMPLEVELBASIC)
Specified by:
compAction in interface IMonitor
Parameters:
compName - logical name of the current component.
action - action currently done by the component.

compAction

public void compAction(int compLevel,
                       java.lang.String compName,
                       java.lang.String action)
Indicates a specific action of a component.
The method is executed only if compLevel is lower or equal the current component monitoring level.
Specified by:
compAction in interface IMonitor
Parameters:
compLevel - component monitor level; 0 (ConfMonitor.COMPLEVELBASIC), 1 (ConfMonitor.COMPLEVELMEDIUM), 2 (ConfMonitor.COMPLEVELDETAIL.
compName - logical name of the current component.
action - action currently done by the component.

isJarmActiveForRequest

public boolean isJarmActiveForRequest()
Indicates whether monitoring or tracing is switched on or off for this request
Specified by:
isJarmActiveForRequest in interface IMonitor
Returns:
true <-> monitoring or tracing is switched on (request still active)
false <-> neither monitoring nor tracing is switched on for this request or request already ended

getMonitorSwitch

public boolean getMonitorSwitch()
Indicates whether monitoring is switched on or off for this request
Specified by:
getMonitorSwitch in interface IMonitor
Returns:
true <-> monitoring is switched on (request still active)
false <-> monitoring is switched off for this request or request already ended

getTraceSwitch

public boolean getTraceSwitch()
Indicates whether tracing is switched on or off for this request
Specified by:
getTraceSwitch in interface IMonitor
Returns:
true <-> tracing is switched on (request still active)
false <-> tracing is not switched on for this request or request already ended

getComponentLevel

public int getComponentLevel()
The component level for the request is returned. The level depends on the parameters IConfMonitor.COMPLEVEL and IConfMonitor.COMPTRACELEVEL. If monitoring is switched on and tracing is switched off IConfMonitor.COMPLEVEL is used. Vice versa it's IConfMonitor.COMPTRACELEVEL. If monitoring and tracing is switched on the most detailed level is used. At the beginning of a request before the first component is started the level could be overwritten by IMonitor.setComponentLevel().
After the first component is started the level is fixed for the whole request.
Specified by:
getComponentLevel in interface IMonitor
Returns:
component monitor level; 0 (ConfMonitor.COMPLEVELBASIC), 1 (ConfMonitor.COMPLEVELMEDIUM), 2 (ConfMonitor.COMPLEVELDETAIL, -1(ConfMonitor.UNDEFDATA because request has already finished)

getUser

public java.lang.String getUser()
Delivers the user name of the request
Specified by:
getUser in interface IMonitor
Returns:
name of user who executes the request; if name is null, ConfMonitor.UNDEFNAME is returned

getReqName

public java.lang.String getReqName()
Delivers the name of the request
Specified by:
getReqName in interface IMonitor
Returns:
name of the request; if name is null, ConfMonitor.UNDEFNAME is returned

getReqTS

public long getReqTS()
Delivers the start timestamp of the request
Specified by:
getReqTS in interface IMonitor
Returns:
start timestamp of the request as it was measured with System.currentTimeMillis()

setUser

public void setUser(java.lang.String userName)
If the user name was not known when the request was started it could be set by this call afterwards; if a user name is already bound to the request the call is skipped
Specified by:
setUser in interface IMonitor
Parameters:
userName - name of user who executes the request

setDescription

public void setDescription(java.lang.String descr)
Set description for request (text string); if the description is already set for the request it could not be overwritten
Specified by:
setDescription in interface IMonitor
Parameters:
descr - description

setComponentLevel

public void setComponentLevel(int compLevel)
The component monitor level for the request is set.
The level could only be set right at the beginning of a request before the first component is started. Otherwise the call is ignored. After the first component call the level is fixed for the whole request.
Specified by:
setComponentLevel in interface IMonitor
Parameters:
compLevel; - 0 (ConfMonitor.COMPLEVELBASIC), 1 (ConfMonitor.COMPLEVELMEDIUM), 2 (ConfMonitor.COMPLEVELDETAIL.

Copyright @ 2001 SAP. All Rights Reserved.