Class RemoteGetSingleKeyCollector
- java.lang.Object
-
- org.infinispan.interceptors.distribution.RemoteGetSingleKeyCollector
-
- All Implemented Interfaces:
ResponseCollector<SuccessfulResponse>
public class RemoteGetSingleKeyCollector extends Object implements ResponseCollector<SuccessfulResponse>
Return the first successful response for a staggered remote get, used in dist mode. Throw anOutdatedTopologyExceptionif all responses are eitherUnsureResponseorCacheNotFoundResponse. Throw an exception immediately if a response is exceptional or unexpected.- Since:
- 9.4
- Author:
- Dan Berindei
-
-
Constructor Summary
Constructors Constructor Description RemoteGetSingleKeyCollector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SuccessfulResponseaddResponse(Address sender, Response response)Called when a response is received, or when a target node becomes unavailable.SuccessfulResponsefinish()Called afterResponseCollector.addResponse(Address, Response)returnsnullfor the last response.
-
-
-
Method Detail
-
addResponse
public SuccessfulResponse addResponse(Address sender, Response response)
Description copied from interface:ResponseCollectorCalled when a response is received, or when a target node becomes unavailable.When a target node leaves the cluster, this method is called with a
CacheNotFoundResponse.Should return a non-
nullresult if the request should complete, ornullif 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 andaddResponse()still returnsnull,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 whileaddResponse()is running.- Specified by:
addResponsein interfaceResponseCollector<SuccessfulResponse>
-
finish
public SuccessfulResponse finish()
Description copied from interface:ResponseCollectorCalled afterResponseCollector.addResponse(Address, Response)returnsnullfor the last response.If
finish()finishes normally, the request will complete with its return value (even ifnull). Iffinish()throws an exception, the request will complete exceptionally with that exception, wrapped in aCompletionException(unless the exception is already aCompletionException).- Specified by:
finishin interfaceResponseCollector<SuccessfulResponse>
-
-