public class RemoteGetSingleKeyCollector extends Object implements ResponseCollector<SuccessfulResponse>
OutdatedTopologyException
if all responses are either UnsureResponse
or
CacheNotFoundResponse
.
Throw an exception immediately if a response is exceptional or unexpected.Constructor and Description |
---|
RemoteGetSingleKeyCollector() |
Modifier and Type | Method and Description |
---|---|
SuccessfulResponse |
addResponse(Address sender,
Response response)
Called when a response is received, or when a target node becomes unavailable.
|
SuccessfulResponse |
finish()
Called after
ResponseCollector.addResponse(Address, Response) returns null for the last response. |
public SuccessfulResponse addResponse(Address sender, Response response)
ResponseCollector
When 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<SuccessfulResponse>
public SuccessfulResponse finish()
ResponseCollector
ResponseCollector.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<SuccessfulResponse>
Copyright © 2021 JBoss by Red Hat. All rights reserved.