public final class QueueSphereClientDecorator extends SphereClientDecorator implements SphereClient
SphereClient to limit the amount of parallel requests which await an answer.
If maxParallelRequests are waiting for a response every further request will be added to an unbound queue.
Then the next answer will cause that the first request in the queue will be executed.| 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,
int maxParallelRequests) |
static SphereClient |
of(SphereClient delegate,
int maxParallelRequests,
boolean closeUnderlyingClient) |
getConfigclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetConfig, of, ofpublic <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 SphereClientDecoratorpublic static SphereClient of(SphereClient delegate, int maxParallelRequests, boolean closeUnderlyingClient)
public static SphereClient of(SphereClient delegate, int maxParallelRequests)