コード例 #1
0
 private void bindVariableIntercept(
     InstrumentClass preparedStatement, ClassLoader classLoader, ProtectionDomain protectedDomain)
     throws InstrumentException {
   List<Method> bindMethod = PreparedStatementUtils.findBindVariableSetMethod();
   final Scope scope = byteCodeInstrumentor.getScope(JtdsScope.SCOPE_NAME);
   Interceptor interceptor =
       new ScopeDelegateStaticInterceptor(new PreparedStatementBindVariableInterceptor(), scope);
   int interceptorId = -1;
   for (Method method : bindMethod) {
     String methodName = method.getName();
     String[] parameterType = JavaAssistUtils.getParameterType(method.getParameterTypes());
     try {
       if (interceptorId == -1) {
         interceptorId = preparedStatement.addInterceptor(methodName, parameterType, interceptor);
       } else {
         preparedStatement.reuseInterceptor(methodName, parameterType, interceptorId);
       }
     } catch (NotFoundInstrumentException e) {
       // Cannot find bind variable setter method. This is not an error. logging will be enough.
       if (logger.isDebugEnabled()) {
         logger.debug(
             "bindVariable api not found. method:{} param:{} Cause:{}",
             methodName,
             Arrays.toString(parameterType),
             e.getMessage());
       }
     }
   }
 }
コード例 #2
0
ファイル: DefaultAgent.java プロジェクト: masonmei/apm-agent
 private void preLoadClass() {
   logger.debug(
       "preLoadClass:{}",
       PreparedStatementUtils.class.getName(),
       PreparedStatementUtils.findBindVariableSetMethod());
 }