Examples of shouldRetry()


Examples of com.sun.sgs.impl.util.ShouldRetryIo.shouldRetry()

    public void testShouldRetryMaxRetry() throws InterruptedException {
  ShouldRetryIo should = new ShouldRetryIo(300, 110);
  long start = System.currentTimeMillis();
  long stop = start + 300;
  while (stop > System.currentTimeMillis() + 110) {
      assertTrue(should.shouldRetry());
  }
  assertFalse(should.shouldRetry());
    }

    @Test
View Full Code Here

Examples of com.sun.sgs.impl.util.ShouldRetryIo.shouldRetry()

  long start = System.currentTimeMillis();
  long stop = start + 300;
  while (stop > System.currentTimeMillis() + 110) {
      assertTrue(should.shouldRetry());
  }
  assertFalse(should.shouldRetry());
    }

    @Test
    public void testShouldRetryRetryWait() throws InterruptedException {
  ShouldRetryIo should = new ShouldRetryIo(300, 100);
View Full Code Here

Examples of com.sun.sgs.impl.util.ShouldRetryIo.shouldRetry()

    public void testShouldRetryRetryWait() throws InterruptedException {
  ShouldRetryIo should = new ShouldRetryIo(300, 100);
  long stop = System.currentTimeMillis() + 300;
  while (stop < System.currentTimeMillis()) {
      long now = System.currentTimeMillis();
      should.shouldRetry();
      long delay = System.currentTimeMillis() - now;
      assertTrue("Delay should be greater than 90 and less than 110: " +
           delay,
           delay > 90 && delay < 110);
  }
View Full Code Here

Examples of com.sun.sgs.impl.util.ShouldRetryIo.shouldRetry()

    /* -- Test ioSucceeded -- */

    @Test
    public void testIoSucceeded() throws InterruptedException {
  ShouldRetryIo should = new ShouldRetryIo(100, 0);
  assertTrue(should.shouldRetry());
  Thread.sleep(110);
  should.ioSucceeded();
  assertTrue(should.shouldRetry());
    }
}
View Full Code Here

Examples of com.sun.sgs.impl.util.ShouldRetryIo.shouldRetry()

    public void testIoSucceeded() throws InterruptedException {
  ShouldRetryIo should = new ShouldRetryIo(100, 0);
  assertTrue(should.shouldRetry());
  Thread.sleep(110);
  should.ioSucceeded();
  assertTrue(should.shouldRetry());
    }
}
View Full Code Here

Examples of com.sun.sgs.impl.util.ShouldRetryIo.shouldRetry()

  while (true) {
      try {
    return (CachingDataStoreServer) LocateRegistry.getRegistry(
        serverHost, serverPort).lookup("CachingDataStoreServer");
      } catch (IOException e) {
    if (!retry.shouldRetry()) {
        throw e;
    }
      }
  }
    }
View Full Code Here

Examples of com.sun.sgs.impl.util.ShouldRetryIo.shouldRetry()

  ShouldRetryIo retry = new ShouldRetryIo(maxRetry, retryWait);
  while (true) {
      try {
    return server.registerNode(callbackProxy);
      } catch (IOException e) {
    if (!retry.shouldRetry()) {
        throw e;
    }
      }
  }
    }
View Full Code Here

Examples of mireka.smtp.EnhancedStatus.shouldRetry()

    public void testEnhancedStatusRfc821Status() {
        Response response = new Response(550, "mailbox unavailable");
        Rfc821Status rfc821Status = new Rfc821Status(response);
        EnhancedStatus enhancedStatus = new EnhancedStatus(rfc821Status);
        assertTrue(enhancedStatus.getEnhancedStatusCode().startsWith("5."));
        assertFalse(enhancedStatus.shouldRetry());
    }

    @Test
    public void testGetMessagePrefixedWithEnhancedStatusCodeEmpty() {
        EnhancedStatus status = new EnhancedStatus(500, "5.0.0", "");
View Full Code Here

Examples of org.apache.camel.processor.aggregate.OptimisticLockRetryPolicy.shouldRetry()

        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

Examples of org.apache.camel.processor.aggregate.OptimisticLockRetryPolicy.shouldRetry()

            case 0:
            case 1:
                assertTrue(policy.shouldRetry(i));
                break;
            default:
                assertFalse(policy.shouldRetry(i));
            }
        }
    }

    private long doDelay(OptimisticLockRetryPolicy policy, int i) throws InterruptedException {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.