duplicated probe

  4 posts   Feedicon  
Replies: 3 - Last Post: February 06, 2012 11:46
by: ihepda
showing 1 - 4 of 4
 
Posted: February 01, 2012 11:42 by ihepda
Hi all,
I'm using btrace 1.2.1 with JVM 1.6.0_24 in Linux Environment. I want monitor jdbc call and I've used the example script JDBCQueries.
Below the script:

@TLS
private static String preparingStatement;

@TLS
private static String executingStatement;

@OnMethod(clazz = "+java.sql.Connection", method = "/prepare(Call|Statement)/", location = @Location(Kind.ENTRY))
public static void onPrepare(@Self Object current, AnyType[] args) {
println(current);
print("prepare statement : ");
println(args[0]);
println(Threads.jstackStr(2)); // print the first 2 lines of the stack trace
preparingStatement = str(args[0]);
}


When I execute btrace the probe generate a duplicated print in console:

oracle.jdbc.driver.T4CConnection@6313e1
prepare statement : select ... (hidden)
it.lispa.esb.sdicta.components.SecurityComponent.onCall(SecurityComponent.java:46)
org.mule.model.resolvers.CallableEntryPointResolver.invoke(CallableEntryPointResolver.java:50)

oracle.jdbc.driver.T4CConnection@6313e1
prepare statement : select ... (hidden)
it.lispa.tributi.sicurezza.services.SecurityServiceImpl.login(SecurityServiceImpl.java:119)
it.lispa.esb.sdicta.components.SecurityComponent.onCall(SecurityComponent.java:46)



The right print is the second becouse SecurityComponent.onCall doesn't execute any query but call the SecurityServiceImpl.login that execute the query.

What happen?
Thanks
Claudio
 
Posted: February 02, 2012 12:30 by Jaroslav Bachorik
There seems no reason for calling the probe code twice. Is there a possibility of posting here the code of SecurityComponent.onCall() method?

Another option would be turning on dumping the transformed classes (consult the user guide on how to do that) and then attaching the modified class file to a JIRA issue.

Without this information, I am afraid, I can not help you much Frown

-JB-
 
Posted: February 06, 2012 11:01 by ihepda
Hi Jaroslav,
I've seen that oracle use a hierarchical structure for the connection:
- OracleConnectionWrapper (that has the prepareStatement/Call methods)
- OracleConnection extends OracleConnectionWrapper
- PhysicalConnection extends OracleConnection (that has the prepareStatement/Call methods)
- T4CConnection extends PhysicalConnection

Now I think that the duplicated call are triggered by OracleConnectionWrapper e PhysicalConnection when call overloaded methods.

The think that I don't understand are stacktraces
 
Posted: February 06, 2012 11:46 by ihepda
Hi,
I've understood the problem.
The PhysicalConnection of Oracle use the overloaded methods and I've used the Threads.jstackStr(int) in a wrong way (the integer in input remove the first row, I thought that it shown the first row).

Now... is there a method to set a method with the signature (parameters in input) in the OnMethod annotation?
For example :
@OnMethod(clazz = "+java.sql.Statement", method ="/prepare(Call|Statement)\(java.lang.String\)/", location = @Location(Kind.ENTRY))
Replies: 3 - Last Post: February 06, 2012 11:46
by: ihepda
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close