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) |
getConfig
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getConfig, of, of
public 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)
SphereClient
execute
in interface SphereClient
execute
in class SphereClientDecorator
T
- type of the result for the requestsphereRequest
- request to Composable Commerce to performpublic void close()
SphereClient
close
in interface SphereClient
close
in interface AutoCloseable
close
in class SphereClientDecorator