Package org.apache.camel.processor.aggregate

Examples of org.apache.camel.processor.aggregate.OptimisticLockRetryPolicy


            assertTrue(elapsed >= policy.getRetryDelay() - precision);
        }
    }

    public void testMaximumRetries() throws Exception {
        OptimisticLockRetryPolicy policy = new OptimisticLockRetryPolicy();
        policy.setRandomBackOff(false);
        policy.setExponentialBackOff(false);
        policy.setMaximumRetryDelay(0L);
        policy.setMaximumRetries(2);
        policy.setRetryDelay(50L);

        for (int i = 0; i < 10; i++) {
            switch (i) {
            case 0:
            case 1:
                assertTrue(policy.shouldRetry(i));
                break;
            default:
                assertFalse(policy.shouldRetry(i));
            }
        }
    }
View Full Code Here


    public OptimisticLockRetryPolicyDefinition() {
    }

    public OptimisticLockRetryPolicy createOptimisticLockRetryPolicy() {
        OptimisticLockRetryPolicy policy = new OptimisticLockRetryPolicy();
        if (maximumRetries != null) {
            policy.setMaximumRetries(maximumRetries);
        }
        if (retryDelay != null) {
            policy.setRetryDelay(retryDelay);
        }
        if (maximumRetryDelay != null) {
            policy.setMaximumRetryDelay(maximumRetryDelay);
        }
        if (exponentialBackOff != null) {
            policy.setExponentialBackOff(exponentialBackOff);
        }
        if (randomBackOff != null) {
            policy.setRandomBackOff(randomBackOff);
        }
        return policy;
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.processor.aggregate.OptimisticLockRetryPolicy

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.