Search in sources :

Example 1 with RetryContextSupport

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

the class BinaryExceptionClassifierRetryPolicy method registerThrowable.

@Override
public void registerThrowable(RetryContext context, Throwable throwable) {
    RetryContextSupport simpleContext = ((RetryContextSupport) context);
    simpleContext.registerThrowable(throwable);
}
Also used : RetryContextSupport(cn.taketoday.retry.context.RetryContextSupport)

Example 2 with RetryContextSupport

use of cn.taketoday.retry.context.RetryContextSupport in project today-infrastructure 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 3 with RetryContextSupport

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

the class SoftReferenceMapRetryContextCacheTests method testPut.

@Test
public void testPut() {
    RetryContextSupport context = new RetryContextSupport(null);
    cache.put("foo", context);
    assertEquals(context, cache.get("foo"));
}
Also used : RetryContextSupport(cn.taketoday.retry.context.RetryContextSupport) Test(org.junit.Test)

Example 4 with RetryContextSupport

use of cn.taketoday.retry.context.RetryContextSupport in project today-infrastructure 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)

Example 5 with RetryContextSupport

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

the class RetrySynchronizationManagerTests method testClear.

@Test
public void testClear() throws Exception {
    RetryContext status = new RetryContextSupport(null);
    RetryContext value = RetrySynchronizationManager.register(status);
    assertNull(value);
    RetrySynchronizationManager.clear();
    value = RetrySynchronizationManager.register(status);
    assertNull(value);
}
Also used : RetryContext(cn.taketoday.retry.RetryContext) 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