Search in sources :

Example 1 with CompleteTransactionCommand

use of org.infinispan.commands.remote.recovery.CompleteTransactionCommand in project infinispan by infinispan.

the class RecoveryManagerImpl method forceTransactionCompletionFromCluster.

@Override
public String forceTransactionCompletionFromCluster(XidImpl xid, Address where, boolean commit) {
    CompleteTransactionCommand ctc = commandFactory.buildCompleteTransactionCommand(xid, commit);
    CompletionStage<Map<Address, Response>> completionStage = rpcManager.invokeCommand(where, ctc, MapResponseCollector.validOnly(), rpcManager.getSyncRpcOptions());
    Map<Address, Response> responseMap = rpcManager.blocking(completionStage);
    if (responseMap.size() != 1 || responseMap.get(where) == null) {
        log.expectedJustOneResponse(responseMap);
        throw new CacheException("Expected response size is 1, received " + responseMap);
    }
    // noinspection rawtypes
    return (String) ((SuccessfulResponse) responseMap.get(where)).getResponseValue();
}
Also used : CompleteTransactionCommand(org.infinispan.commands.remote.recovery.CompleteTransactionCommand) Response(org.infinispan.remoting.responses.Response) SuccessfulResponse(org.infinispan.remoting.responses.SuccessfulResponse) Address(org.infinispan.remoting.transport.Address) CacheException(org.infinispan.commons.CacheException) HashMap(java.util.HashMap) ConcurrentMap(java.util.concurrent.ConcurrentMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1 CompleteTransactionCommand (org.infinispan.commands.remote.recovery.CompleteTransactionCommand)1 CacheException (org.infinispan.commons.CacheException)1 Response (org.infinispan.remoting.responses.Response)1 SuccessfulResponse (org.infinispan.remoting.responses.SuccessfulResponse)1 Address (org.infinispan.remoting.transport.Address)1