Search in sources :

Example 6 with OptimisticLockRetryPolicy

use of org.apache.camel.processor.aggregate.OptimisticLockRetryPolicy in project camel by apache.

the class OptimisticLockRetryPolicyTest method testRandomBackOff.

public void testRandomBackOff() throws Exception {
    OptimisticLockRetryPolicy policy = new OptimisticLockRetryPolicy();
    policy.setRandomBackOff(true);
    policy.setExponentialBackOff(false);
    policy.setMaximumRetryDelay(500L);
    for (int i = 0; i < 10; i++) {
        long elapsed = doDelay(policy, i);
        assertTrue(elapsed <= policy.getMaximumRetryDelay() + precision && elapsed >= 0);
    }
}
Also used : OptimisticLockRetryPolicy(org.apache.camel.processor.aggregate.OptimisticLockRetryPolicy)

Aggregations

OptimisticLockRetryPolicy (org.apache.camel.processor.aggregate.OptimisticLockRetryPolicy)6 RouteBuilder (org.apache.camel.builder.RouteBuilder)1 BodyInAggregatingStrategy (org.apache.camel.processor.BodyInAggregatingStrategy)1