Search in sources :

Example 1 with ClearRemoteTransactionOperation

use of com.hazelcast.transaction.impl.xa.operations.ClearRemoteTransactionOperation in project hazelcast by hazelcast.

the class XAClearRemoteTransactionMessageTask method call.

@Override
protected Object call() throws Exception {
    InternalOperationService operationService = nodeEngine.getOperationService();
    InternalPartitionService partitionService = nodeEngine.getPartitionService();
    ClientEndpoint endpoint = getEndpoint();
    Data xidData = serializationService.toData(parameters.xid);
    Operation op = new ClearRemoteTransactionOperation(xidData);
    op.setCallerUuid(endpoint.getUuid());
    int partitionId = partitionService.getPartitionId(xidData);
    InvocationBuilder builder = operationService.createInvocationBuilder(getServiceName(), op, partitionId);
    builder.setTryCount(TRY_COUNT).setResultDeserialized(false);
    builder.invoke();
    return XATransactionClearRemoteCodec.encodeResponse();
}
Also used : ClearRemoteTransactionOperation(com.hazelcast.transaction.impl.xa.operations.ClearRemoteTransactionOperation) InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) Data(com.hazelcast.nio.serialization.Data) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService) ClearRemoteTransactionOperation(com.hazelcast.transaction.impl.xa.operations.ClearRemoteTransactionOperation) Operation(com.hazelcast.spi.Operation) InvocationBuilder(com.hazelcast.spi.InvocationBuilder) ClientEndpoint(com.hazelcast.client.ClientEndpoint) ClientEndpoint(com.hazelcast.client.ClientEndpoint)

Example 2 with ClearRemoteTransactionOperation

use of com.hazelcast.transaction.impl.xa.operations.ClearRemoteTransactionOperation in project hazelcast by hazelcast.

the class XAResourceImpl method clearRemoteTransactions.

private void clearRemoteTransactions(Xid xid) {
    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);
    ClearRemoteTransactionOperation operation = new ClearRemoteTransactionOperation(xidData);
    operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) ClearRemoteTransactionOperation(com.hazelcast.transaction.impl.xa.operations.ClearRemoteTransactionOperation) IPartitionService(com.hazelcast.spi.partition.IPartitionService) Data(com.hazelcast.nio.serialization.Data) OperationService(com.hazelcast.spi.OperationService)

Aggregations

Data (com.hazelcast.nio.serialization.Data)2 ClearRemoteTransactionOperation (com.hazelcast.transaction.impl.xa.operations.ClearRemoteTransactionOperation)2 ClientEndpoint (com.hazelcast.client.ClientEndpoint)1 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)1 InvocationBuilder (com.hazelcast.spi.InvocationBuilder)1 NodeEngine (com.hazelcast.spi.NodeEngine)1 Operation (com.hazelcast.spi.Operation)1 OperationService (com.hazelcast.spi.OperationService)1 InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)1 IPartitionService (com.hazelcast.spi.partition.IPartitionService)1