Beispiel #1
0
 public void test_第二层_1() {
   Profiler.enter("第二层_1");
   try {
     Thread.sleep(2000);
   } catch (InterruptedException e) {
     e
         .printStackTrace(); // To change body of catch statement use File | Settings | File
                             // Templates.
   }
   Profiler.release();
 }
  @Override
  public Object intercept(
      Object target, Method method, Object[] methodParams, MethodProxy methodProxy)
      throws Throwable {
    // 用户进行判断
    // TODO 再完善一下打印的信息 最好能过滤出类名和方法名出来
    Object result = null;

    //        class com.liusoft.tools.test.AOPSupportBean$$EnhancerByCGLIB$$ef560001test3
    String proxyCalss = target.getClass().getName();

    TimeUnit timeUnit = null;
    try {
      timeUnit = TimeUnit.valueOf(timeUnitName);
    } catch (Exception e) {
    }

    Profiler.enter(proxyCalss.split("\\$\\$")[0] + "." + method.getName(), timeUnit);

    result = methodProxy.invokeSuper(target, methodParams);
    Profiler.release();
    return result;
  }
Beispiel #3
0
 public void test_第一层() {
   Profiler.enter("第一层");
   test_第二层();
   Profiler.release();
 }