public interface TimedOperationsTransformDescriptor
TimedOperationsTransformDescriptor is used to define the various "Timed Operations" which the user wants to monitor. Each instance of TimedOperationsTransformDescriptor defines a single timed operation configuration.
The following is an example snippet:
public class MyTimedOperationDefination implements com.ibm.wsspi.timedoperations.TimedOperationsTransformDescriptor
private static final String classToInstrument = "com/mypackage/MyClass";
private static final String methodToInstrument = "myMethod";
private static final String descOfMethod = "(Ljava.lang.String)V";
private static final String timedOpsType = "SOME_STATIC_TYPE";
public String getClassName()
return classToInstrument;
}
public String getMethodName() {
return methodToInstrument;
}
public String getType() {
return timedOpsType;
}
public String getMethodDesc() {
return descOfMethod;
}
public String getPattern(Object instanceOfThisClass, Object methodArgs) {
String rcString = "";
//If an instance of 'com.mypackage.MyClass' is useful, then use it and get the correct message for this timed operation
if (instanceOfThisClass != null){
com.mypackage.MyClass passedInstance = (com.mypackage.MyClass) instanceOfThisClass;
//Do something here with this object and get the right meta data String and assign to rcString;
}
//If helpful you can use the argument (String in this case) in your method
//Get the necessary data from arguments and assign to rcString;
if(methodArgs!=null){
Object[] params = null;
if (Object[].class.isInstance(methodArgs)) {
params = (Object[]) methodArgs;
for (int i = 0; i < params.length; i++) {
System.out.println("ARG "+i+" = "+params[i] );
}
}
}
return rcString;
}
}
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getClassName()
Returns the name of class, which needs to be monitored.
|
java.lang.String |
getMethodDesc()
Returns the Method Descriptor which belongs to above class/method (see
getClassName() and see getMethodName() ). |
java.lang.String |
getMethodName()
Returns the name of method which belongs to above class (see
getClassName() ), which needs to be monitored. |
java.lang.String |
getPattern(java.lang.Object thisInstance,
java.lang.Object objArrays)
Get pattern of Timed Operation.
|
java.lang.String |
getType()
Type of Timed Operation.
|
java.lang.String getClassName()
java.lang.String getMethodName()
getClassName()
), which needs to be monitored. If method is overridden, getMethodDesc()
will be
used to differentiate it.java.lang.String getMethodDesc()
getClassName()
and see getMethodName()
).getMethodName()
.java.lang.String getType()
java.lang.String getPattern(java.lang.Object thisInstance, java.lang.Object objArrays)
thisInstance
- thisInstance is the instance of class, which is used for timed operation. (Same class defined in getClassName();)objArrays
- Actual parameter objects which are passed to method, defined by getMethodName()