@ApplicationScoped public class DisableAnnotationClient extends Object
Each method has an easy test to determine whether it's annotations are active or not.
Constructor and Description |
---|
DisableAnnotationClient() |
Modifier and Type | Method and Description |
---|---|
Future<String> |
asyncWaitThenReturn()
Returns a future which will be complete on method return if Asynchronous is disabled, or incomplete if
Asynchronous is enabled.
|
void |
failAndRetryOnce()
Always throws
TestException , should increment counter by two if Retry is enabled, or one if it is not |
String |
failRetryOnceThenFallback()
Should return normally if Fallback is enabled or throw TestException if not
|
void |
failWithCircuitBreaker()
Always throws TestException on first invocation, throws
CircuitBreakerOpenException on second if
CircuitBreaker is enabled |
void |
failWithTimeout()
Throws
TimeoutException if Timeout is enabled or
TestException otherwise |
String |
fallback() |
int |
getFailAndRetryOnceCounter()
Returns the number of times that
failAndRetryOnce() has been executed |
int |
getFailRetryOnceThenFallbackCounter()
Returns the number of times that
failRetryOnceThenFallback() has been executed |
void |
waitForBulkheadExecutions(int count)
Wait for
count executions of waitWithBulkhead(Future) to be in progress. |
void |
waitWithBulkhead(Future<?> waitingFuture)
Blocks waiting for
waitingFuture to complete |
@Retry(maxRetries=1) public void failAndRetryOnce()
TestException
, should increment counter by two if Retry is enabled, or one if it is notpublic int getFailAndRetryOnceCounter()
failAndRetryOnce()
has been executed@Retry(maxRetries=1) @Fallback(fallbackMethod="fallback") public String failRetryOnceThenFallback()
Should increment counter by two if Retry is enabled or one if it is not
public int getFailRetryOnceThenFallbackCounter()
failRetryOnceThenFallback()
has been executedpublic String fallback()
@CircuitBreaker(successThreshold=2, requestVolumeThreshold=1, failureRatio=1.0, delay=50000L) public void failWithCircuitBreaker()
CircuitBreakerOpenException
on second if
CircuitBreaker is enabled
Throw test exception on second invocation if CircuitBreaker is disabled
@Timeout(value=500L) public void failWithTimeout()
TimeoutException
if Timeout is enabled or
TestException otherwise@Bulkhead(value=2) public void waitWithBulkhead(Future<?> waitingFuture)
waitingFuture
to complete
If passed an already completed Future
, this method will return immediately.
Should permit two simultaneous calls if bulkhead enabled, or more if bulkhead disabled.
waitingFuture
- the future to wait forpublic void waitForBulkheadExecutions(int count)
count
executions of waitWithBulkhead(Future)
to be in progress.count
- execution count@Asynchronous public Future<String> asyncWaitThenReturn()
Copyright © 2016 – 2022 Eclipse Foundation. All rights reserved.
Use is subject to license terms.