@Test public void itShortCircuitsFailingClientEventually() throws InterruptedException { AmazonS3 s3 = FailsafeS3Decorator.decorate(new FailingS3Client()); for (int i = 0; i < 100; i++ ) { try { s3.getObjectMetadata("test-bucket", "test-key"); } catch (AmazonServiceException e) { assertThat(e.getStatusCode()).isEqualTo(500); } catch (CircuitBreakerOpenException e) { return; } Thread.sleep(50); } fail("Failsafe never short-circuited"); }
public static FailsafeS3Decorator decorate(AmazonS3 s3) { return decorate(s3, defaultCircuitBreaker()); }
FailsafeS3Decorator extends S3Decorator { public static FailsafeS3Decorator decorate(AmazonS3 s3) { return decorate(s3, defaultCircuitBreaker()); } }
FailsafeS3Decorator extends S3Decorator { public static FailsafeS3Decorator decorate(AmazonS3 s3) { return decorate(s3, defaultCircuitBreaker()); } private  FailsafeS3Decorator(AmazonS3 delegate, CircuitBreaker circuitBreaker); }
FailsafeS3Decorator extends S3Decorator { public static FailsafeS3Decorator decorate(AmazonS3 s3) { return decorate(s3, defaultCircuitBreaker()); } private  FailsafeS3Decorator(AmazonS3 delegate, CircuitBreaker circuitBreaker); static FailsafeS3Decorator decorate(AmazonS3 s3); static FailsafeS3Decorator decorate(AmazonS3 s3, CircuitBreaker circuitBreaker); }
FailsafeS3Decorator extends S3Decorator { public static FailsafeS3Decorator decorate(AmazonS3 s3) { return decorate(s3, defaultCircuitBreaker()); } private  FailsafeS3Decorator(AmazonS3 delegate, CircuitBreaker circuitBreaker); static FailsafeS3Decorator decorate(AmazonS3 s3); static FailsafeS3Decorator decorate(AmazonS3 s3, CircuitBreaker circuitBreaker);  }