use of com.shulie.instrument.simulator.api.scope.InterceptorScopeInvocation in project LinkAgent by shulieTech.
the class ScopedParametersWrapperInterceptor method getParameter.
@Override
public Object[] getParameter(Advice advice) throws Throwable {
final InterceptorScopeInvocation transaction = getScope(advice).getCurrentInvocation();
Object[] result = advice.getParameterArray();
try {
final boolean success = transaction.tryEnter(policy);
if (success) {
return interceptor.getParameter(advice);
} else {
if (logger.isDebugEnabled()) {
logger.debug("tryAfter() returns false: interceptorScopeTransaction: {}, executionPoint: {}. Skip interceptor {}", transaction, policy, interceptor.getClass());
}
}
} finally {
if (transaction.canLeave(policy)) {
transaction.leave(policy);
}
}
return result;
}
use of com.shulie.instrument.simulator.api.scope.InterceptorScopeInvocation in project LinkAgent by shulieTech.
the class ScopedModificationInterceptor method getParameter.
@Override
public Object[] getParameter(Advice advice) throws Throwable {
final InterceptorScopeInvocation transaction = getScope(advice).getCurrentInvocation();
Object[] result = advice.getParameterArray();
if (transaction.tryEnter(policy)) {
result = interceptor.getParameter(advice);
} else {
if (logger.isDebugEnabled()) {
logger.debug("tryBefore() returns false: interceptorScopeTransaction: {}, executionPoint: {}. Skip interceptor {}", transaction, policy, interceptor.getClass());
}
}
return result;
}
use of com.shulie.instrument.simulator.api.scope.InterceptorScopeInvocation in project LinkAgent by shulieTech.
the class ScopedModificationInterceptor method getExceptionResult.
@Override
public Object getExceptionResult(Advice advice) throws Throwable {
final InterceptorScopeInvocation transaction = getScope(advice).getCurrentInvocation();
final boolean success = transaction.canLeave(policy);
try {
if (success) {
return interceptor.getExceptionResult(advice);
} else {
if (logger.isDebugEnabled()) {
logger.debug("doException() returns false: interceptorScopeTransaction: {}, executionPoint: {}. Skip interceptor {}", transaction, policy, interceptor.getClass());
}
}
} finally {
if (success) {
transaction.leave(policy);
}
}
throw advice.getThrowable();
}
use of com.shulie.instrument.simulator.api.scope.InterceptorScopeInvocation in project LinkAgent by shulieTech.
the class ScopedModificationInterceptor method getResult.
@Override
public Object getResult(Advice advice) throws Throwable {
final InterceptorScopeInvocation transaction = getScope(advice).getCurrentInvocation();
final boolean success = transaction.canLeave(policy);
try {
if (success) {
return interceptor.getResult(advice);
} else {
if (logger.isDebugEnabled()) {
logger.debug("tryAfter() returns false: interceptorScopeTransaction: {}, executionPoint: {}. Skip interceptor {}", transaction, policy, interceptor.getClass());
}
return advice.getReturnObj();
}
} finally {
if (success) {
transaction.leave(policy);
}
}
}
use of com.shulie.instrument.simulator.api.scope.InterceptorScopeInvocation in project LinkAgent by shulieTech.
the class ScopedTraceInterceptor method doBefore.
@Override
public void doBefore(Advice advice) throws Throwable {
final InterceptorScopeInvocation transaction = getScope(advice).getCurrentInvocation();
final boolean success = transaction.tryEnter(policy);
boolean processControlException = false;
if (success) {
try {
interceptor.doBefore(advice);
} catch (ProcessControlException p) {
processControlException = true;
throw p;
} finally {
if (processControlException) {
transaction.leave(policy);
}
}
} else {
if (logger.isDebugEnabled()) {
logger.debug("tryBefore() returns false: interceptorScopeTransaction: {}, executionPoint: {}. Skip interceptor {}", transaction, policy, interceptor.getClass());
}
}
}
Aggregations