public final class TimeoutSphereClientDecorator extends SphereClientDecorator implements SphereClient
SphereClient to add timeouts.
There are no guarantees that the timeout will be after the exact duration.
The underlying HTTP client most likely will have a timeout and you may consider to implement it there.
If the timeout occurs a SphereTimeoutException will be thrown.| Modifier and Type | Method and Description |
|---|---|
void |
close()
Shuts down the client to save resources like connections and threads.
|
<T> CompletionStage<T> |
execute(SphereRequest<T> sphereRequest)
Executes asynchronously a request to Composable Commerce.
|
static SphereClient |
of(SphereClient delegate,
Duration duration) |
static SphereClient |
of(SphereClient delegate,
long delay,
TimeUnit timeUnit) |
getConfigclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetConfig, of, ofpublic static SphereClient of(SphereClient delegate, long delay, TimeUnit timeUnit)
public static SphereClient of(SphereClient delegate, Duration duration)
public <T> CompletionStage<T> execute(SphereRequest<T> sphereRequest)
SphereClientexecute in interface SphereClientexecute in class SphereClientDecoratorT - type of the result for the requestsphereRequest - request to Composable Commerce to performpublic void close()
SphereClientclose in interface SphereClientclose in interface AutoCloseableclose in class SphereClientDecorator