Search in sources :

Example 11 with RetryContextSupport

use of cn.taketoday.retry.context.RetryContextSupport in project today-framework by TAKETODAY.

the class ExceptionClassifierRetryPolicy method registerThrowable.

/**
 * Delegate to the policy currently activated in the context.
 *
 * @see RetryPolicy#registerThrowable(RetryContext,
 * Throwable)
 */
public void registerThrowable(RetryContext context, Throwable throwable) {
    RetryPolicy policy = (RetryPolicy) context;
    policy.registerThrowable(context, throwable);
    ((RetryContextSupport) context).registerThrowable(throwable);
}
Also used : RetryPolicy(cn.taketoday.retry.RetryPolicy) RetryContextSupport(cn.taketoday.retry.context.RetryContextSupport)

Example 12 with RetryContextSupport

use of cn.taketoday.retry.context.RetryContextSupport in project today-framework by TAKETODAY.

the class RetrySynchronizationManagerTests method testStatusRegistration.

@Test
public void testStatusRegistration() throws Exception {
    RetryContext status = new RetryContextSupport(null);
    RetryContext value = RetrySynchronizationManager.register(status);
    assertNull(value);
    value = RetrySynchronizationManager.register(status);
    assertEquals(status, value);
}
Also used : RetryContext(cn.taketoday.retry.RetryContext) RetryContextSupport(cn.taketoday.retry.context.RetryContextSupport) Test(org.junit.Test)

Example 13 with RetryContextSupport

use of cn.taketoday.retry.context.RetryContextSupport in project today-framework by TAKETODAY.

the class RetrySynchronizationManagerTests method testParent.

@Test
public void testParent() throws Exception {
    RetryContext parent = new RetryContextSupport(null);
    RetryContext child = new RetryContextSupport(parent);
    assertSame(parent, child.getParent());
}
Also used : RetryContext(cn.taketoday.retry.RetryContext) RetryContextSupport(cn.taketoday.retry.context.RetryContextSupport) Test(org.junit.Test)

Example 14 with RetryContextSupport

use of cn.taketoday.retry.context.RetryContextSupport in project today-framework by TAKETODAY.

the class SoftReferenceMapRetryContextCacheTests method testPutOverLimit.

@Test(expected = RetryCacheCapacityExceededException.class)
public void testPutOverLimit() {
    RetryContextSupport context = new RetryContextSupport(null);
    cache.setCapacity(1);
    cache.put("foo", context);
    cache.put("foo", context);
}
Also used : RetryContextSupport(cn.taketoday.retry.context.RetryContextSupport) Test(org.junit.Test)

Example 15 with RetryContextSupport

use of cn.taketoday.retry.context.RetryContextSupport in project today-framework by TAKETODAY.

the class MapRetryContextCacheTests method testPutOverLimit.

@Test(expected = RetryCacheCapacityExceededException.class)
public void testPutOverLimit() {
    RetryContextSupport context = new RetryContextSupport(null);
    cache.setCapacity(1);
    cache.put("foo", context);
    cache.put("foo", context);
}
Also used : RetryContextSupport(cn.taketoday.retry.context.RetryContextSupport) Test(org.junit.Test)

Aggregations

RetryContextSupport (cn.taketoday.retry.context.RetryContextSupport)22 Test (org.junit.Test)18 RetryContext (cn.taketoday.retry.RetryContext)6 RetryPolicy (cn.taketoday.retry.RetryPolicy)2