Package org.eclipse.microprofile.fault.tolerance.tck.timeout.clientserver

# Class UninterruptableTimeoutClient

java.lang.Object
org.eclipse.microprofile.fault.tolerance.tck.timeout.clientserver.UninterruptableTimeoutClient

@RequestScoped public class UninterruptableTimeoutClient extends Object

## Constructor Summary

Constructors
Constructor
Description
`UninterruptableTimeoutClient()`

## Method Summary

Modifier and Type
Method
Description
`Future<String>`
`fallback(Future<?> waitingFuture)`
`int`
`getTimeoutAsyncBulkheadCounter()`
`int`
`getTimeoutAsyncRetryCounter()`
`void`
`serviceTimeout(long waitMs)`
Waits for at least `waitms`, then returns
`Future<Void>`
`serviceTimeoutAsync(Future<?> waitingFuture, CompletableFuture<Void> completion)`
Waits for waitingFuture to complete, then returns.
`Future<Void>`
`serviceTimeoutAsyncBulkhead(Future<?> waitingFuture)`
Waits for waitingFuture to complete, then returns.
`Future<Void>`
`serviceTimeoutAsyncBulkheadQueueTimed(Future<?> waitingFuture)`
Waits for waitingFuture to complete, then returns.
`CompletionStage<Void>`
`serviceTimeoutAsyncCS(long waitMs)`
Waits for at least `waitMs`, then returns
`Future<String>`
`serviceTimeoutAsyncFallback(Future<?> waitingFuture)`
Waits for waitingFuture to complete, then returns.
`Future<Void>`
`serviceTimeoutAsyncRetry(Future<?> waitingFuture)`
Waits for waitingFuture to complete, then returns.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### UninterruptableTimeoutClient

public UninterruptableTimeoutClient()

## Method Details

### serviceTimeout

@Timeout(value=500L, unit=MILLIS) public void serviceTimeout(long waitMs)
Waits for at least `waitms`, then returns

Times out in 500ms.

Does not respect thread interruption.

Uses a tight loop so the thread interrupted flag should be set when the method returns

Parameters:
  `waitMs` - the time to wait

### serviceTimeoutAsync

@Timeout(value=500L, unit=MILLIS) @Asynchronous public Future<Void> serviceTimeoutAsync(Future<?> waitingFuture, CompletableFuture<Void> completion)
Waits for waitingFuture to complete, then returns.

Times out in 500ms.

Runs asynchronously.

Does not respect thread interruption.

Parameters:
  `waitingFuture` - future to wait for
  `completion` - future that this method will complete before returning
Returns:
  a completed future

### serviceTimeoutAsyncCS

@Timeout(value=500L, unit=MILLIS) @Asynchronous public CompletionStage<Void> serviceTimeoutAsyncCS(long waitMs)
Waits for at least `waitMs`, then returns

Times out in 500ms

Runs asynchronously

Does not respect thread interruption.

Uses a tight loop so the thread interrupted flag should be set when the method returns

Parameters:
  `waitMs` - the time to wait
Returns:
  a completed CompletionStage

### serviceTimeoutAsyncBulkhead

@Timeout(value=500L, unit=MILLIS) @Asynchronous @Bulkhead(value=1, waitingTaskQueue=1) public Future<Void> serviceTimeoutAsyncBulkhead(Future<?> waitingFuture)
Waits for waitingFuture to complete, then returns.

Times out in 500ms.

Runs asynchronously.

Does not respect thread interruption.

Has a bulkhead with capacity of 1, queue size of 1.

Increments timeoutAsyncBulkheadCounter.

Parameters:
  `waitingFuture` - future to wait for
Returns:
  a completed future

### getTimeoutAsyncBulkheadCounter

public int getTimeoutAsyncBulkheadCounter()

### serviceTimeoutAsyncBulkheadQueueTimed

@Timeout(value=500L, unit=MILLIS) @Asynchronous @Bulkhead(value=1, waitingTaskQueue=1) public Future<Void> serviceTimeoutAsyncBulkheadQueueTimed(Future<?> waitingFuture)
Waits for waitingFuture to complete, then returns.

Times out in 500ms.

Runs asynchronously.

Does not respect thread interruption.

Has a bulkhead with capacity of 1, queue size of 1.

Parameters:
  `waitingFuture` - future to wait for
Returns:
  a completed Future

### serviceTimeoutAsyncRetry

@Timeout(value=500L, unit=MILLIS) @Asynchronous @Retry(maxRetries=2, delay=0L, jitter=0L) public Future<Void> serviceTimeoutAsyncRetry(Future<?> waitingFuture)
Waits for waitingFuture to complete, then returns.

Times out in 500ms.

Runs asynchronously.

Does not respect thread interruption.

Will do 2 retries with no delay.

Increments timeoutAsyncRetryCounter.

Parameters:
  `waitingFuture` - future to wait for
Returns:
  a completed Future

### getTimeoutAsyncRetryCounter

public int getTimeoutAsyncRetryCounter()

Returns:
  value of timeoutAsyncRetryCounter

### serviceTimeoutAsyncFallback

@Timeout(value=500L, unit=MILLIS) @Asynchronous @Fallback(fallbackMethod="fallback") public Future<String> serviceTimeoutAsyncFallback(Future<?> waitingFuture)
Waits for waitingFuture to complete, then returns.

Times out in 500ms.

Runs asynchronously.

Does not respect thread interruption.

Will run the fallback method on exception

Parameters:
  `waitingFuture` - future to wait for
Returns:
  Future completed with "OK", or completed with "FALLBACK" if the fallback ran

### fallback

public Future<String> fallback(Future<?> waitingFuture)