use of com.hazelcast.transaction.TransactionContext in project hazelcast by hazelcast.
the class TransactionalSetAddMessageTask method innerCall.
@Override
protected Object innerCall() throws Exception {
final TransactionContext context = endpoint.getTransactionContext(parameters.txnId);
TransactionalSet<Object> set = context.getSet(parameters.name);
return set.add(parameters.item);
}
use of com.hazelcast.transaction.TransactionContext in project hazelcast by hazelcast.
the class TransactionalMapReplaceMessageTask method innerCall.
@Override
protected Object innerCall() throws Exception {
final TransactionContext context = getEndpoint().getTransactionContext(parameters.txnId);
final TransactionalMap map = context.getMap(parameters.name);
Object oldValue = map.replace(parameters.key, parameters.value);
return serializationService.toData(oldValue);
}
use of com.hazelcast.transaction.TransactionContext in project hazelcast by hazelcast.
the class TransactionalMultiMapRemoveMessageTask method innerCall.
@Override
protected Object innerCall() throws Exception {
final TransactionContext context = endpoint.getTransactionContext(parameters.txnId);
TransactionalMultiMap<Object, Object> multiMap = context.getMultiMap(parameters.name);
Collection<Object> collection = multiMap.remove(parameters.key);
List<Data> list = new ArrayList<Data>(collection.size());
for (Object o : collection) {
list.add(serializationService.toData(o));
}
return list;
}
use of com.hazelcast.transaction.TransactionContext in project hazelcast by hazelcast.
the class XAResourceProxy method rollback.
@Override
public void rollback(Xid xid) throws XAException {
List<TransactionContext> contexts = xidContextMap.remove(xid);
if (contexts == null) {
finalizeTransactionRemotely(xid, false);
return;
}
for (TransactionContext context : contexts) {
getTransaction(context).rollback();
}
clearRemoteTransactions(xid);
}
use of com.hazelcast.transaction.TransactionContext in project hazelcast by hazelcast.
the class XAResourceProxy method createTransactionContext.
private TransactionContext createTransactionContext(Xid xid) {
ClientContext clientContext = getContext();
ClientTransactionManagerService transactionManager = clientContext.getTransactionManager();
TransactionContext context = transactionManager.newXATransactionContext(xid, timeoutInSeconds.get());
getTransaction(context).begin();
return context;
}
Aggregations