Package com.sun.sgs.impl.util

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


  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

    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

    /* -- 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

    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

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

  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

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.