|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
jrunx.kernel.ServiceAdapter | +--jrunx.instrument.MethodInstrumentor
| Field Summary | |
static int |
CALL_ENTER
|
static int |
CALL_EXIT
|
protected static java.lang.reflect.Method |
currentTimeMillisMethod
|
static int |
DEFAULT_LOGGER
|
protected static java.lang.reflect.Method |
hashCodeMethod
|
protected static java.lang.reflect.Method |
logMethod
|
static int |
METHOD_ENTER
|
static int |
METHOD_EXIT
|
static int |
REQUEST_THREAD
|
protected static java.lang.ThreadLocal |
threadResults
|
| Fields inherited from class jrunx.kernel.ServiceAdapter |
DEFAULT_DEACTIVATED, DEFAULT_DOMAIN, DOMAIN_NAME_SEPARATOR, DOMAIN_NAME_SUFFIX, domainName, jndiBindable, LOGGER_CACHE_TIME, SCHEDULER_SERVICE, SECURITY_MANAGER, server, status, TRANSACTION_MANAGER |
| Fields inherited from interface jrunx.kernel.Service |
INITIALIZED, STARTED, STARTING, STOPPED, STOPPING, UNINITIALIZED |
| Constructor Summary | |
MethodInstrumentor()
|
|
| Method Summary | |
protected int |
callCurrentTimeMillis(jrunx.instrument.BCMethod method,
jrunx.instrument.Code code)
|
protected jrunx.instrument.Instruction |
callLog(jrunx.instrument.BCMethod method,
jrunx.instrument.Code code,
jrunx.instrument.Instruction currentIns,
int type,
jrunx.instrument.MethodInstruction callMethod,
int timerVar)
Invokes the log method. |
static void |
clearRequestThreadResults()
Clears the instrumentation results |
java.util.List |
getClassNameList()
Returns the list of className attributes |
boolean |
getDirectSubclasses()
Returns the directSubclasses flag |
java.util.List |
getExcludeCallsToList()
Returns the list of excludeCallsTo attributes |
boolean |
getInstrumentCalls()
Returns the instrumentCalls flag |
java.util.List |
getInstrumentCallsToList()
Returns the list of the instrumentCallsTo attributes |
java.util.List |
getInstrumentMethodList()
Returns the list of the instrumentMethod attributes |
boolean |
getInstrumentMethods()
Returns the instrumentMethods flag |
protected static int |
getLineNumber(jrunx.instrument.BCMethod method,
jrunx.instrument.Code code,
jrunx.instrument.Instruction ins)
|
java.lang.String |
getLoggingCallEnterLabel()
Gets the method call entry description |
java.lang.String |
getLoggingCallExitLabel()
Gets the method call exit description |
java.lang.String |
getLoggingDelimiter()
Returns the logging delimiter |
java.lang.String |
getLoggingMethodEnterLabel()
Gets the method entry description |
java.lang.String |
getLoggingMethodExitLabel()
Gets the method exit description |
boolean |
getOutputToRequestThread()
Returns the outputToRequestThread flag |
boolean |
getOutputToStandardLogger()
Returns the outputToStandardLogger flag |
static java.util.Set |
getRequestThreadResults()
Gets the Set of MethodInstrumentationResult objects accumulated for this request. |
protected static java.lang.String |
getSignature(java.lang.String[] types)
|
protected static void |
initMethods()
|
byte[] |
instrument(java.lang.String name,
byte[] bytes,
java.lang.ClassLoader loader)
Instrument the bytes of the class file. |
protected void |
instrumentCall(jrunx.instrument.BCMethod method,
jrunx.instrument.Code code,
jrunx.instrument.MethodInstruction ins,
jrunx.instrument.Instruction lastValidLine,
int timerVar)
|
protected void |
instrumentMethod(jrunx.instrument.BCMethod method)
Instrument the given method |
protected void |
instrumentMethods(com.techtrader.modules.tools.bytecode.BCClass bcClass)
Instrument the methods of the given class |
protected void |
instrumentReturn(jrunx.instrument.BCMethod method,
jrunx.instrument.Code code,
jrunx.instrument.ReturnInstruction ret,
jrunx.instrument.Instruction lastValidLine,
int timerVar)
|
static void |
log(int target,
int type,
java.lang.String className,
int hashCode,
java.lang.String methodName,
java.lang.String methodType,
java.lang.String callClassName,
java.lang.String callMethodName,
java.lang.String callMethodType,
int lineNo,
long elapsed)
Logs instrumentation info. |
static void |
main(java.lang.String[] args)
Just a test |
protected boolean |
match(java.lang.String name,
java.util.List list)
Determine if the given name matches an entry in the list. |
protected boolean |
match(java.lang.String name,
java.util.List list,
java.util.List excludeList)
Determine if the given name matches an entry in the list. |
protected boolean |
match(java.lang.String name,
java.lang.String value)
Determine if the given name matches the value. |
protected boolean |
match(java.lang.String name,
java.lang.String value,
java.util.List excludeList)
Determine if the given name matches the value. |
void |
setClassName(java.lang.String className)
The name of the class(es) to instrument. |
void |
setDirectSubclasses(boolean direct)
If true all direct subclasses of the class(es) given will also be instrumented |
void |
setExcludeCallsTo(java.lang.String exclude)
The excludeCallsTo attribute specifies the method calls that will excluded when using method call instrumentation. |
void |
setInstrumentCalls(boolean instrumentCalls)
If true method call instrumentation will be done. |
void |
setInstrumentCallsTo(java.lang.String callsTo)
If using method call instrumentation, specifies which method calls will be instrumented. |
void |
setInstrumentMethod(java.lang.String method)
The name of the method(s) to instrument within the class. |
void |
setInstrumentMethods(boolean instrumentMethods)
If true method instrumentation will be done. |
void |
setLoggingCallEnterLabel(java.lang.String desc)
Sets the description name used when logging instrumented method calls. |
void |
setLoggingCallExitLabel(java.lang.String desc)
Sets the description name used when logging instrumented method calls. |
void |
setLoggingDelimiter(java.lang.String delimiter)
Sets the delimiter used for the standard logger. |
void |
setLoggingMethodEnterLabel(java.lang.String desc)
Sets the description name used when logging instrumented methods. |
void |
setLoggingMethodExitLabel(java.lang.String desc)
Sets the description name used when logging instrumented methods. |
void |
setOutputToRequestThread(boolean requestThread)
If true output from instrumentation will be sent to the request thread |
void |
setOutputToStandardLogger(boolean standardLogger)
If true output from instrumentation will be sent to the standard logger |
protected boolean |
shouldInstrument(com.techtrader.modules.tools.bytecode.BCClass bcClass)
|
void |
start()
Every service other than mere data collections should start |
| Methods inherited from interface jrunx.kernel.ServiceMBean |
bind, getBindToJNDI, getDeactivated, getDomainName, getJRunService, getLogger, getName, getParentService, getServerName, requestServer, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, unbind |
| Methods inherited from interface jrunx.kernel.Service |
destroy, getStatus, init, stop, updateStatus |
| Field Detail |
public static final int DEFAULT_LOGGER
public static final int REQUEST_THREAD
public static final int METHOD_ENTER
public static final int METHOD_EXIT
public static final int CALL_ENTER
public static final int CALL_EXIT
protected static java.lang.reflect.Method logMethod
protected static java.lang.reflect.Method currentTimeMillisMethod
protected static java.lang.reflect.Method hashCodeMethod
protected static java.lang.ThreadLocal threadResults
| Constructor Detail |
public MethodInstrumentor()
| Method Detail |
public void setExcludeCallsTo(java.lang.String exclude)
MethodInstrumentorMBeansetExcludeCallsTo in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanexclude - The exclude attributepublic java.util.List getExcludeCallsToList()
MethodInstrumentorMBeangetExcludeCallsToList in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanpublic void setClassName(java.lang.String className)
MethodInstrumentorMBeansetClassName in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanclassName - The class to instrumentpublic java.util.List getClassNameList()
MethodInstrumentorMBeangetClassNameList in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanpublic void setDirectSubclasses(boolean direct)
MethodInstrumentorMBeansetDirectSubclasses in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeandirect - Instrument direct subclassespublic boolean getDirectSubclasses()
MethodInstrumentorMBeangetDirectSubclasses in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanpublic void setInstrumentMethods(boolean instrumentMethods)
MethodInstrumentorMBeansetInstrumentMethods in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeaninstrumentMethods - Instrument methodspublic boolean getInstrumentMethods()
MethodInstrumentorMBeangetInstrumentMethods in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanpublic void setInstrumentMethod(java.lang.String method)
MethodInstrumentorMBeansetInstrumentMethod in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeaninstrumentMethod - The name of the method(s) to instrumentpublic java.util.List getInstrumentMethodList()
MethodInstrumentorMBeangetInstrumentMethodList in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanpublic void setInstrumentCalls(boolean instrumentCalls)
MethodInstrumentorMBeansetInstrumentCalls in interface MethodInstrumentorMBeanpublic boolean getInstrumentCalls()
MethodInstrumentorMBeangetInstrumentCalls in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanpublic void setInstrumentCallsTo(java.lang.String callsTo)
MethodInstrumentorMBeansetInstrumentCallsTo in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeancallstTo - The name of the method call(s) to instrumentpublic java.util.List getInstrumentCallsToList()
MethodInstrumentorMBeangetInstrumentCallsToList in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanpublic void setOutputToStandardLogger(boolean standardLogger)
MethodInstrumentorMBeansetOutputToStandardLogger in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanstandardLogger - true if output should be sent to the standard loggerpublic boolean getOutputToStandardLogger()
MethodInstrumentorMBeangetOutputToStandardLogger in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanpublic void setOutputToRequestThread(boolean requestThread)
MethodInstrumentorMBeansetOutputToRequestThread in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanrequestThread - true if output should be sent to the request threadpublic boolean getOutputToRequestThread()
MethodInstrumentorMBeangetOutputToRequestThread in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanpublic void setLoggingDelimiter(java.lang.String delimiter)
MethodInstrumentorMBeansetLoggingDelimiter in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeandelimiter - The delimiterpublic java.lang.String getLoggingDelimiter()
MethodInstrumentorMBeangetLoggingDelimiter in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanpublic void setLoggingMethodEnterLabel(java.lang.String desc)
MethodInstrumentorMBeansetLoggingMethodEnterLabel in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeandesc - The descriptionpublic java.lang.String getLoggingMethodEnterLabel()
MethodInstrumentorMBeangetLoggingMethodEnterLabel in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanpublic void setLoggingMethodExitLabel(java.lang.String desc)
MethodInstrumentorMBeansetLoggingMethodExitLabel in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeandesc - The descriptionpublic java.lang.String getLoggingMethodExitLabel()
MethodInstrumentorMBeangetLoggingMethodExitLabel in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanpublic void setLoggingCallEnterLabel(java.lang.String desc)
MethodInstrumentorMBeansetLoggingCallEnterLabel in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeandesc - The descriptionpublic java.lang.String getLoggingCallEnterLabel()
MethodInstrumentorMBeangetLoggingCallEnterLabel in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeanpublic void setLoggingCallExitLabel(java.lang.String desc)
MethodInstrumentorMBeansetLoggingCallExitLabel in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBeandesc - The descriptionpublic java.lang.String getLoggingCallExitLabel()
MethodInstrumentorMBeangetLoggingCallExitLabel in interface MethodInstrumentorMBeanjrunx.instrument.MethodInstrumentorMBean
public void start()
throws java.lang.Exception
ServiceAdapterstart in interface Servicestart in class ServiceAdapter
public byte[] instrument(java.lang.String name,
byte[] bytes,
java.lang.ClassLoader loader)
throws java.io.IOException
Instrumentorinstrument in interface Instrumentorjrunx.instrument.Instrumentorname - The class namebytes - The class bytesloader - The ClassLoader that loaded the classprotected boolean shouldInstrument(com.techtrader.modules.tools.bytecode.BCClass bcClass)
protected boolean match(java.lang.String name,
java.util.List list)
protected boolean match(java.lang.String name,
java.util.List list,
java.util.List excludeList)
protected boolean match(java.lang.String name,
java.lang.String value)
protected boolean match(java.lang.String name,
java.lang.String value,
java.util.List excludeList)
protected void instrumentMethods(com.techtrader.modules.tools.bytecode.BCClass bcClass)
throws java.io.IOException
protected void instrumentMethod(jrunx.instrument.BCMethod method)
throws java.io.IOException
protected static void initMethods()
throws java.io.IOException
protected void instrumentReturn(jrunx.instrument.BCMethod method,
jrunx.instrument.Code code,
jrunx.instrument.ReturnInstruction ret,
jrunx.instrument.Instruction lastValidLine,
int timerVar)
protected void instrumentCall(jrunx.instrument.BCMethod method,
jrunx.instrument.Code code,
jrunx.instrument.MethodInstruction ins,
jrunx.instrument.Instruction lastValidLine,
int timerVar)
protected int callCurrentTimeMillis(jrunx.instrument.BCMethod method,
jrunx.instrument.Code code)
protected jrunx.instrument.Instruction callLog(jrunx.instrument.BCMethod method,
jrunx.instrument.Code code,
jrunx.instrument.Instruction currentIns,
int type,
jrunx.instrument.MethodInstruction callMethod,
int timerVar)
protected static int getLineNumber(jrunx.instrument.BCMethod method,
jrunx.instrument.Code code,
jrunx.instrument.Instruction ins)
protected static java.lang.String getSignature(java.lang.String[] types)
public static void log(int target,
int type,
java.lang.String className,
int hashCode,
java.lang.String methodName,
java.lang.String methodType,
java.lang.String callClassName,
java.lang.String callMethodName,
java.lang.String callMethodType,
int lineNo,
long elapsed)
target - The logging target (DEFAULT_LOGGER, REQUEST_THREAD, or both)type - The type of instrumentation (METHOD_ENTER, METHOD_EXIT, CALL_ENTER, CALL_EXIT)className - The name of the classhashCode - The object hashcodemethodName - The name of the methodmethodType - The type (signature) of the methodcallClassName - The class name of the method being calledcallMethodName - The name of the method being calledcallMethodType - The type (signature) of the method being calledlineNo - The source line number, or 0 if not knownelapsed - The elapsed time spent in the method or method callpublic static java.util.Set getRequestThreadResults()
public static void clearRequestThreadResults()
public static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||