use of org.apache.ignite.configuration.TransactionConfiguration in project ignite by apache.
the class GridPartitionedCacheJtaFactorySelfTest method configureJta.
/** {@inheritDoc} */
@Override
protected void configureJta(IgniteConfiguration cfg) {
TransactionConfiguration txCfg = cfg.getTransactionConfiguration();
txCfg.setTxManagerFactory(new Factory<TransactionManager>() {
private static final long serialVersionUID = 0L;
@Override
public TransactionManager create() {
return jotm.getTransactionManager();
}
});
}
use of org.apache.ignite.configuration.TransactionConfiguration in project ignite by apache.
the class CacheKeepBinaryTransactionTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
TransactionConfiguration txCfg = new TransactionConfiguration();
txCfg.setDefaultTxConcurrency(TransactionConcurrency.OPTIMISTIC);
txCfg.setDefaultTxIsolation(TransactionIsolation.REPEATABLE_READ);
cfg.setTransactionConfiguration(txCfg);
cfg.setMarshaller(new BinaryMarshaller());
CacheConfiguration ccfg = new CacheConfiguration("tx-cache");
ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
cfg.setCacheConfiguration(ccfg);
return cfg;
}
use of org.apache.ignite.configuration.TransactionConfiguration in project ignite by apache.
the class GridCacheAbstractPartitionedByteArrayValuesSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TransactionConfiguration tCfg = new TransactionConfiguration();
tCfg.setTxSerializableEnabled(true);
cfg.setTransactionConfiguration(tCfg);
return cfg;
}
use of org.apache.ignite.configuration.TransactionConfiguration in project ignite by apache.
the class GridCacheAdapter method asyncOp.
/**
* @param op Cache operation.
* @param <T> Return type.
* @return Future.
*/
@SuppressWarnings("unchecked")
private <T> IgniteInternalFuture<T> asyncOp(final AsyncOp<T> op) {
try {
checkJta();
} catch (IgniteCheckedException e) {
return new GridFinishedFuture<>(e);
}
if (log.isDebugEnabled())
log.debug("Performing async op: " + op);
GridNearTxLocal tx = ctx.tm().threadLocalTx(ctx);
CacheOperationContext opCtx = ctx.operationContextPerCall();
final TransactionConfiguration txCfg = CU.transactionConfiguration(ctx, ctx.kernalContext().config());
if (tx == null || tx.implicit()) {
// Save value of thread-local flag.
boolean skipStore = ctx.skipStore();
int retries = opCtx != null && opCtx.noRetries() ? 1 : MAX_RETRIES;
if (retries == 1) {
tx = ctx.tm().newTx(true, op.single(), ctx.systemTx() ? ctx : null, OPTIMISTIC, READ_COMMITTED, txCfg.getDefaultTxTimeout(), !skipStore, 0);
return asyncOp(tx, op, opCtx, /*retry*/
false);
} else {
AsyncOpRetryFuture<T> fut = new AsyncOpRetryFuture<>(op, retries, opCtx);
fut.execute(/*retry*/
false);
return fut;
}
} else
return asyncOp(tx, op, opCtx, /*retry*/
false);
}
use of org.apache.ignite.configuration.TransactionConfiguration in project ignite by apache.
the class IgniteTransactionsImpl method txStartEx.
/**
* {@inheritDoc}
*/
@Override
public GridNearTxLocal txStartEx(GridCacheContext ctx, TransactionConcurrency concurrency, TransactionIsolation isolation) {
A.notNull(concurrency, "concurrency");
A.notNull(isolation, "isolation");
checkTransactional(ctx);
TransactionConfiguration cfg = CU.transactionConfiguration(ctx, cctx.kernalContext().config());
return txStart0(concurrency, isolation, cfg.getDefaultTxTimeout(), 0, ctx.systemTx() ? ctx : null);
}
Aggregations