Search in sources :

Example 11 with InterceptorScopeInvocation

use of com.shulie.instrument.simulator.api.scope.InterceptorScopeInvocation in project LinkAgent by shulieTech.

the class ScopedTraceInterceptor method doException.

@Override
public void doException(Advice advice) throws Throwable {
    final InterceptorScopeInvocation transaction = getScope(advice).getCurrentInvocation();
    boolean success = transaction.canLeave(policy);
    try {
        if (success) {
            interceptor.doException(advice);
        } else {
            if (logger.isDebugEnabled()) {
                logger.debug("doException() returns false: interceptorScopeTransaction: {}, executionPoint: {}. Skip interceptor {}", transaction, policy, interceptor.getClass());
            }
        }
    } finally {
        if (success) {
            transaction.leave(policy);
        }
    }
}
Also used : InterceptorScopeInvocation(com.shulie.instrument.simulator.api.scope.InterceptorScopeInvocation)

Example 12 with InterceptorScopeInvocation

use of com.shulie.instrument.simulator.api.scope.InterceptorScopeInvocation in project LinkAgent by shulieTech.

the class ScopedTraceInterceptor method doAfter.

@Override
public void doAfter(Advice advice) throws Throwable {
    final InterceptorScopeInvocation transaction = getScope(advice).getCurrentInvocation();
    boolean success = transaction.canLeave(policy);
    try {
        if (success) {
            interceptor.doAfter(advice);
        } else {
            if (logger.isDebugEnabled()) {
                logger.debug("tryAfter() returns false: interceptorScopeTransaction: {}, executionPoint: {}. Skip interceptor {}", transaction, policy, interceptor.getClass());
            }
        }
    } finally {
        if (success) {
            transaction.leave(policy);
        }
    }
}
Also used : InterceptorScopeInvocation(com.shulie.instrument.simulator.api.scope.InterceptorScopeInvocation)

Aggregations

InterceptorScopeInvocation (com.shulie.instrument.simulator.api.scope.InterceptorScopeInvocation)12 InterceptorScope (com.shulie.instrument.simulator.api.scope.InterceptorScope)2 CutOffResult (com.pamirs.pradar.CutOffResult)1 ProcessControlException (com.shulie.instrument.simulator.api.ProcessControlException)1