Search in sources :

Example 1 with XATransaction

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

the class PutRemoteTransactionBackupOperation method run.

@Override
public void run() throws Exception {
    XAService xaService = getService();
    NodeEngine nodeEngine = getNodeEngine();
    XATransaction transaction = new XATransaction(nodeEngine, records, txnId, xid, txOwnerUuid, timeoutMillis, startTime);
    xaService.putTransaction(transaction);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) XAService(com.hazelcast.transaction.impl.xa.XAService) XATransaction(com.hazelcast.transaction.impl.xa.XATransaction)

Example 2 with XATransaction

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

the class PutRemoteTransactionOperation method run.

@Override
public void run() throws Exception {
    XAService xaService = getService();
    NodeEngine nodeEngine = getNodeEngine();
    XATransaction transaction = new XATransaction(nodeEngine, records, txnId, xid, txOwnerUuid, timeoutMillis, startTime);
    xaService.putTransaction(transaction);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) XAService(com.hazelcast.transaction.impl.xa.XAService) XATransaction(com.hazelcast.transaction.impl.xa.XATransaction)

Example 3 with XATransaction

use of com.hazelcast.transaction.impl.xa.XATransaction 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 4 with XATransaction

use of com.hazelcast.transaction.impl.xa.XATransaction 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)

Aggregations

XAService (com.hazelcast.transaction.impl.xa.XAService)4 XATransaction (com.hazelcast.transaction.impl.xa.XATransaction)4 NodeEngine (com.hazelcast.spi.NodeEngine)3 ExecutionCallback (com.hazelcast.core.ExecutionCallback)1 XATransactionDTO (com.hazelcast.transaction.impl.xa.XATransactionDTO)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1