@Experimental public abstract class ValidResponseCollector<T> extends Object implements ResponseCollector<T>
null value or throwing an exception from any of the
addValidResponse(Address, ValidResponse), addException(Address, Exception), or
addTargetNotFound(Address) methods will complete the request.
If all invocations return null, the request will be completed with the result of finish().| Constructor and Description |
|---|
ValidResponseCollector() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
addException(Address sender,
Exception exception)
Process an exception from a target.
|
T |
addResponse(Address sender,
Response response)
Called when a response is received, or when a target node becomes unavailable.
|
protected abstract T |
addTargetNotFound(Address sender)
Process a target leaving the cluster or stopping the cache.
|
protected abstract T |
addValidResponse(Address sender,
ValidResponse response)
Process a valid response from a target.
|
abstract T |
finish()
Called after
ResponseCollector.addResponse(Address, Response) returns null for the last response. |
public final T addResponse(Address sender, Response response)
ResponseCollectorWhen a target node leaves the cluster, this method is called with a
CacheNotFoundResponse.
Should return a non-null result if the request should complete with that value, or null
if it should wait for more responses.
If the method throws an exception, the request will be completed with that exception.
If the last response is received and addResponse() still returns null,
ResponseCollector.finish() will also be called to obtain a result.
Thread safety: addResponse() will *not* be called concurrently from multiple threads,
and the request will not be completed while addResponse() is running.
addResponse in interface ResponseCollector<T>public abstract T finish()
ResponseCollectorResponseCollector.addResponse(Address, Response) returns null for the last response.
If finish() finishes normally, the request will complete with its return value
(even if null).
If finish() throws an exception, the request will complete exceptionally with that exception,
wrapped in a CompletionException (unless the exception is already a
CompletionException).
finish in interface ResponseCollector<T>protected abstract T addValidResponse(Address sender, ValidResponse response)
null to continue waiting for response, non-null to complete with that value.protected abstract T addTargetNotFound(Address sender)
null to continue waiting for response, non-null to complete with that value.Copyright © 2022 JBoss by Red Hat. All rights reserved.