Package net.anotheria.moskito.core.calltrace

Examples of net.anotheria.moskito.core.calltrace.CurrentlyTracedCall


    if (methodStats != null) {
      methodStats.addRequest();
    }
    TracedCall aRunningTrace = RunningTraceContainer.getCurrentlyTracedCall();
    TraceStep currentStep = null;
    CurrentlyTracedCall currentTrace = aRunningTrace.callTraced() ? (CurrentlyTracedCall) aRunningTrace : null;
    if (currentTrace != null) {
      StringBuilder call = new StringBuilder(producerId).append('.').append(method).append("(");
      if (args != null && args.length > 0) {
        for (int i = 0; i < args.length; i++) {
          call.append(args[i]);
          if (i < args.length - 1) {
            call.append(", ");
          }
        }
      }
      call.append(")");
      currentStep = currentTrace.startStep(call.toString(), producer);
    }
    long startTime = System.nanoTime();
    Object ret = null;
    try {
      ret = pjp.proceed();
      return ret;
    } catch (InvocationTargetException e) {
      defaultStats.notifyError();
      if (methodStats != null) {
        methodStats.notifyError();
      }
      //System.out.println("exception of class: "+e.getCause()+" is thrown");
      if (currentStep != null) {
        currentStep.setAborted();
      }
      throw e.getCause();
    } catch (Throwable t) {
      defaultStats.notifyError();
      if (methodStats != null) {
        methodStats.notifyError();
      }
      if (currentStep != null) {
        currentStep.setAborted();
      }
      throw t;
    } finally {
      long exTime = System.nanoTime() - startTime;
      defaultStats.addExecutionTime(exTime);
      if (methodStats != null) {
        methodStats.addExecutionTime(exTime);
      }
      defaultStats.notifyRequestFinished();
      if (methodStats != null) {
        methodStats.notifyRequestFinished();
      }
      if (currentStep != null) {
        currentStep.setDuration(exTime);
        try {
          currentStep.appendToCall(" = " + ret);
        } catch (Throwable t) {
          currentStep.appendToCall(" = ERR: " + t.getMessage() + " (" + t.getClass() + ")");
        }
      }
      if (currentTrace != null) {
        currentTrace.endStep();
      }
    }
  }
View Full Code Here

TOP

Related Classes of net.anotheria.moskito.core.calltrace.CurrentlyTracedCall

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.