use of com.pamirs.pradar.CutOffResult in project LinkAgent by shulieTech.
the class ScopedCutoffInterceptor method cutoff.
@Override
public CutOffResult cutoff(Advice advice) throws Throwable {
final InterceptorScopeInvocation transaction = getScope(advice).getCurrentInvocation();
CutOffResult result = CutOffResult.passed();
try {
final boolean success = transaction.tryEnter(policy);
if (success) {
return interceptor.cutoff(advice);
} else {
if (logger.isDebugEnabled()) {
logger.debug("tryBefore() returns false: interceptorScopeTransaction: {}, executionPoint: {}. Skip interceptor {}", transaction, policy, interceptor.getClass());
}
}
} finally {
if (transaction.canLeave(policy)) {
transaction.leave(policy);
}
}
return result;
}
use of com.pamirs.pradar.CutOffResult in project LinkAgent by shulieTech.
the class AbstractProxiedConsumerInterceptor method cutoff0.
@Override
public CutOffResult cutoff0(Advice advice) throws Throwable {
ConsumerProxy consumerProxy = ConsumerHolder.getProxy(advice.getTarget());
if (consumerProxy == null) {
return CutOffResult.passed();
}
Object result = doCutoff(consumerProxy, advice);
if (result instanceof CutOffResult) {
return (CutOffResult) result;
} else {
return CutOffResult.cutoff(result);
}
}
Aggregations