[jboss-cvs] jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/interceptor/jbossaop ...
Takuro Okada
t2-okada at nri.co.jp
Tue Feb 27 01:02:41 EST 2007
User: tokada
Date: 07/02/27 01:02:41
Modified: java/src/expansion/org/jboss/profiler/exp/agent/interceptor/jbossaop
Tag: JBossProfiler_Expansion AopInterceptor.java
Log:
Added an interface
Revision Changes Path
No revision
No revision
1.1.2.3 +16 -6 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/interceptor/jbossaop/Attic/AopInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AopInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/interceptor/jbossaop/Attic/AopInterceptor.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- AopInterceptor.java 19 Feb 2007 10:53:28 -0000 1.1.2.2
+++ AopInterceptor.java 27 Feb 2007 06:02:41 -0000 1.1.2.3
@@ -78,6 +78,7 @@
private int collectorPoolSize = 1;
private int collectorPoolMaxSize = Short.MAX_VALUE;
private int collectorQueueSize = Short.MAX_VALUE;
+ private boolean collectArgs = false;
/*
* metric factory
@@ -130,6 +131,10 @@
this.collectorQueueSize = collectorQueueSize;
}
+ public void setCollectArgs(boolean collectArgs) {
+ this.collectArgs = collectArgs;
+ }
+
private String trimParameter(String parameter) {
String result = null;
if(parameter==null) return result;
@@ -189,35 +194,37 @@
// illegal access
return;
}
+
String operationName = null;
String caller = null;
Object[] arguments = null;
+
if(invocation instanceof MethodInvocation) {
MethodInvocation dInvocation = (MethodInvocation) invocation;
Method method = dInvocation.getActualMethod();
String[] splitMethod = method.getName().split("\\$");
operationName = method.getDeclaringClass().getName() + "." + splitMethod[splitMethod.length-2];
- arguments = dInvocation.getArguments();
+ if(collectArgs) arguments = dInvocation.getArguments();
} else if(invocation instanceof FieldInvocation) {
FieldInvocation dInvocation = (FieldInvocation)invocation;
operationName = dInvocation.getTargetObject().getClass().getName() + "." + dInvocation.getField().getName();
} else if(invocation instanceof ConstructorInvocation) {
ConstructorInvocation dInvocation = (ConstructorInvocation)invocation;
operationName = dInvocation.getTargetObject() + "." + dInvocation.getConstructor().getName();
- arguments = dInvocation.getArguments();
+ if(collectArgs) arguments = dInvocation.getArguments();
} else if(invocation instanceof CallerInvocation) {
CallerInvocation callerInvocation = (CallerInvocation)invocation;
operationName = callerInvocation.getTargetObject().getClass().getName() + ".";
if(callerInvocation instanceof ConstructorCalledByConstructorInvocation) {
ConstructorCalledByConstructorInvocation dInvocation = (ConstructorCalledByConstructorInvocation)callerInvocation;
operationName = operationName.concat(dInvocation.getCalledConstructor().getName());
- arguments = dInvocation.getArguments();
+ if(collectArgs) arguments = dInvocation.getArguments();
// This invocation cannot get caller object.
caller = dInvocation.getCallingConstructor().getDeclaringClass().getName();
} else if(callerInvocation instanceof ConstructorCalledByMethodInvocation) {
ConstructorCalledByMethodInvocation dInvocation = (ConstructorCalledByMethodInvocation)callerInvocation;
operationName = operationName.concat(dInvocation.getCalledConstructor().getName());
- arguments = dInvocation.getArguments();
+ if(collectArgs) arguments = dInvocation.getArguments();
if(dInvocation.getCallingObject() instanceof Servlet) {
caller = "<servlet>";
}else {
@@ -226,13 +233,13 @@
} else if(callerInvocation instanceof MethodCalledByConstructorInvocation) {
MethodCalledByConstructorInvocation dInvocation = (MethodCalledByConstructorInvocation)callerInvocation;
operationName = operationName.concat(dInvocation.getCalledMethod().getName());
- arguments = dInvocation.getArguments();
+ if(collectArgs) arguments = dInvocation.getArguments();
// This invocation cannot get caller object.
caller = dInvocation.getCalling().getDeclaringClass().getName();
} else if(callerInvocation instanceof MethodCalledByMethodInvocation) {
MethodCalledByMethodInvocation dInvocation = (MethodCalledByMethodInvocation)callerInvocation;
operationName = operationName.concat(dInvocation.getCalledMethod().getName());
- arguments = dInvocation.getArguments();
+ if(collectArgs) arguments = dInvocation.getArguments();
if(dInvocation.getCallingObject() instanceof Servlet) {
caller = "<servlet>";
}else {
@@ -244,13 +251,16 @@
}else {
operationName = "<Unknown>";
}
+
collector.setOperationName(operationName);
+
String argumentsExpression = null;
if(arguments!=null && arguments.length>0) {
argumentsExpression = Arrays.toString(arguments);
argumentsExpression = argumentsExpression.substring(1, argumentsExpression.length()-1);
}
collector.setArguments(new Object[]{threadId, caller, argumentsExpression});
+
try {
factory.submitCollector(collector);
} catch (Exception e) {
More information about the jboss-cvs-commits
mailing list