Search in sources :

Example 6 with XAService

use of com.hazelcast.transaction.impl.xa.XAService in project hazelcast by hazelcast.

the class ClearRemoteTransactionBackupOperation method run.

@Override
public void run() throws Exception {
    XAService xaService = getService();
    xaService.removeTransactions(xid);
}
Also used : XAService(com.hazelcast.transaction.impl.xa.XAService)

Example 7 with XAService

use of com.hazelcast.transaction.impl.xa.XAService in project hazelcast by hazelcast.

the class ClearRemoteTransactionOperation method run.

@Override
public void run() throws Exception {
    XAService xaService = getService();
    xaService.removeTransactions(xid);
}
Also used : XAService(com.hazelcast.transaction.impl.xa.XAService)

Example 8 with XAService

use of com.hazelcast.transaction.impl.xa.XAService in project hazelcast by hazelcast.

the class FinalizeRemoteTransactionOperation method run.

@Override
public void run() throws Exception {
    XAService xaService = getService();
    final List<XATransaction> list = xaService.removeTransactions(xid);
    if (list == null) {
        sendResponse(getNodeEngine().toData(XAException.XAER_NOTA));
        return;
    }
    final int size = list.size();
    final ExecutionCallback callback = new ExecutionCallback() {

        AtomicInteger counter = new AtomicInteger();

        @Override
        public void onResponse(Object response) {
            sendResponseIfComplete();
        }

        @Override
        public void onFailure(Throwable t) {
            // TODO log the error
            sendResponseIfComplete();
        }

        void sendResponseIfComplete() {
            if (size == counter.incrementAndGet()) {
                sendResponse(null);
            }
        }
    };
    for (XATransaction xaTransaction : list) {
        finalizeTransaction(xaTransaction, callback);
    }
}
Also used : XAService(com.hazelcast.transaction.impl.xa.XAService) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) XATransaction(com.hazelcast.transaction.impl.xa.XATransaction) ExecutionCallback(com.hazelcast.core.ExecutionCallback)

Example 9 with XAService

use of com.hazelcast.transaction.impl.xa.XAService in project hazelcast by hazelcast.

the class XaReplicationOperation method run.

@Override
public void run() throws Exception {
    XAService xaService = getService();
    NodeEngine nodeEngine = getNodeEngine();
    for (XATransactionDTO transactionDTO : migrationData) {
        XATransaction transaction = new XATransaction(nodeEngine, transactionDTO.getRecords(), transactionDTO.getTxnId(), transactionDTO.getXid(), transactionDTO.getOwnerUuid(), transactionDTO.getTimeoutMilis(), transactionDTO.getStartTime());
        xaService.putTransaction(transaction);
    }
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) XAService(com.hazelcast.transaction.impl.xa.XAService) XATransactionDTO(com.hazelcast.transaction.impl.xa.XATransactionDTO) XATransaction(com.hazelcast.transaction.impl.xa.XATransaction)

Example 10 with XAService

use of com.hazelcast.transaction.impl.xa.XAService in project hazelcast by hazelcast.

the class XATransactionCreateMessageTask method call.

@Override
protected Object call() throws Exception {
    ClientEndpoint endpoint = getEndpoint();
    XAService xaService = getService(getServiceName());
    String ownerUuid = endpoint.getUuid();
    TransactionContext context = xaService.newXATransactionContext(parameters.xid, ownerUuid, (int) parameters.timeout, true);
    TransactionAccessor.getTransaction(context).begin();
    endpoint.setTransactionContext(context);
    return context.getTxnId();
}
Also used : XAService(com.hazelcast.transaction.impl.xa.XAService) TransactionContext(com.hazelcast.transaction.TransactionContext) ClientEndpoint(com.hazelcast.client.ClientEndpoint)

Aggregations

XAService (com.hazelcast.transaction.impl.xa.XAService)10 NodeEngine (com.hazelcast.spi.NodeEngine)4 XATransaction (com.hazelcast.transaction.impl.xa.XATransaction)4 CardinalityEstimatorService (com.hazelcast.cardinality.impl.CardinalityEstimatorService)1 ClientEndpoint (com.hazelcast.client.ClientEndpoint)1 ListService (com.hazelcast.collection.impl.list.ListService)1 QueueService (com.hazelcast.collection.impl.queue.QueueService)1 SetService (com.hazelcast.collection.impl.set.SetService)1 AtomicLongService (com.hazelcast.concurrent.atomiclong.AtomicLongService)1 AtomicReferenceService (com.hazelcast.concurrent.atomicreference.AtomicReferenceService)1 CountDownLatchService (com.hazelcast.concurrent.countdownlatch.CountDownLatchService)1 IdGeneratorService (com.hazelcast.concurrent.idgen.IdGeneratorService)1 LockServiceImpl (com.hazelcast.concurrent.lock.LockServiceImpl)1 SemaphoreService (com.hazelcast.concurrent.semaphore.SemaphoreService)1 ExecutionCallback (com.hazelcast.core.ExecutionCallback)1 DistributedDurableExecutorService (com.hazelcast.durableexecutor.impl.DistributedDurableExecutorService)1 DistributedExecutorService (com.hazelcast.executor.impl.DistributedExecutorService)1 MapService (com.hazelcast.map.impl.MapService)1 MapReduceService (com.hazelcast.mapreduce.impl.MapReduceService)1 MultiMapService (com.hazelcast.multimap.impl.MultiMapService)1