use of com.hazelcast.transaction.impl.xa.operations.FinalizeRemoteTransactionOperation in project hazelcast by hazelcast.
the class XAResourceImpl method finalizeTransactionRemotely.
private void finalizeTransactionRemotely(Xid xid, boolean isCommit) throws XAException {
NodeEngine nodeEngine = getNodeEngine();
IPartitionService partitionService = nodeEngine.getPartitionService();
OperationService operationService = nodeEngine.getOperationService();
SerializableXID serializableXID = new SerializableXID(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier());
Data xidData = nodeEngine.toData(serializableXID);
int partitionId = partitionService.getPartitionId(xidData);
FinalizeRemoteTransactionOperation operation = new FinalizeRemoteTransactionOperation(xidData, isCommit);
InternalCompletableFuture<Integer> future = operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId);
Integer errorCode;
try {
errorCode = future.get();
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
if (errorCode != null) {
throw new XAException(errorCode);
}
}
Aggregations