Examples of ErrorCountingPolicy


Examples of com.betfair.tornjak.monitor.ErrorCountingPolicy

class MonitoredMethodCall {

    private static final Logger LOG = LoggerFactory.getLogger(MonitoredMethodCall.class);
   
    public Object call(ProceedingJoinPoint pjp, PassiveMethodMonitor monitor) throws Throwable {
        ErrorCountingPolicy errorCountingPolicy = monitor.getErrorCountingPolicy();

        Throwable error = null;
        Object ret = null;
        try {
            ret = pjp.proceed();
            return ret;
        } catch (Throwable t) {
            error = t;
            throw t;
        } finally {
            if (error != null) {

                if (LOG.isDebugEnabled()) {
                    LOG.debug("Got a Throwable in monitor: " + monitor.getName(), error);
                }

                if (errorCountingPolicy.countsAsError(error)) {
                    monitor.failure(error);
                } else {
                    monitor.success();
                }
            } else {
                if (errorCountingPolicy.countsAsError(ret)) {
                    monitor.failure("Got return value which is considered an error: " + ret);
                } else {
                    monitor.success();
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.