Package org.apache.james.util.retry.api

Examples of org.apache.james.util.retry.api.RetryHandler


     * Test method for .
     */
    @Test
    public final void testPostFailure() {
  final List<Exception> results = new ArrayList<Exception>();
  RetryHandler handler = new ExceptionRetryHandler(
    _exceptionClasses, _proxy, _schedule, 7) {

      @Override
      public void postFailure(Exception ex, int retryCount) {
    super.postFailure(ex, retryCount);
    results.add(ex);
      }

      @Override
      public Object operation() throws Exception {
    throw new Exception();
      }
  };
  try {
      handler.perform();
  } catch (Exception ex) {
      // no-op
  }
  assertEquals(7, results.size());
    }
View Full Code Here


     * Test method for .
     * @throws Exception
     */
    @Test
    public final void testOperation() throws Exception {
  RetryHandler handler = new ExceptionRetryHandler(
    _exceptionClasses, _proxy, _schedule, 0) {

      @Override
      public Object operation() throws Exception {
    return "Hi!";
      }
  };
  assertEquals("Hi!", handler.operation());
    }
View Full Code Here

TOP

Related Classes of org.apache.james.util.retry.api.RetryHandler

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.