use of org.apache.ignite.transactions.TransactionIsolation in project ignite by apache.
the class IgniteOnePhaseCommitNearSelfTest method checkKey.
/**
* @param transactions Transactions instance.
* @param cache Cache instance.
* @param key Key.
*/
private void checkKey(IgniteTransactions transactions, Cache<Object, Object> cache, int key) throws Exception {
cache.put(key, key);
finalCheck(key, true);
TransactionIsolation[] isolations = { READ_COMMITTED, REPEATABLE_READ, SERIALIZABLE };
TransactionConcurrency[] concurrencies = { OPTIMISTIC, PESSIMISTIC };
for (TransactionIsolation isolation : isolations) {
for (TransactionConcurrency concurrency : concurrencies) {
info("Checking transaction [isolation=" + isolation + ", concurrency=" + concurrency + ']');
try (Transaction tx = transactions.txStart(concurrency, isolation)) {
cache.put(key, isolation + "-" + concurrency);
tx.commit();
}
finalCheck(key, true);
}
}
}
use of org.apache.ignite.transactions.TransactionIsolation in project ignite by apache.
the class IgniteCacheReadThroughStoreCallTest method checkLoadCount.
/**
* @param ccfg Cache configuration.
* @throws Exception If failed.
*/
private void checkLoadCount(CacheConfiguration<Object, Object> ccfg) throws Exception {
storeMap.clear();
Ignite ignite0 = ignite(0);
ignite0.createCache(ccfg);
try {
int key = 0;
for (Ignite node : G.allGrids()) {
log.info("Test for node: " + node.name());
final IgniteCache<Object, Object> cache = node.cache(ccfg.getName());
for (int i = 0; i < 50; i++) {
final int k = key++;
checkReadThrough(cache, new IgniteRunnable() {
@Override
public void run() {
cache.invoke(k, new TestEntryProcessor());
}
}, null, null, 1);
}
for (int i = 0; i < 50; i++) {
final int k = key++;
checkReadThrough(cache, new IgniteRunnable() {
@Override
public void run() {
cache.put(k, k);
}
}, null, null, 0);
}
if (ccfg.getAtomicityMode() == TRANSACTIONAL) {
for (TransactionConcurrency concurrency : TransactionConcurrency.values()) {
for (TransactionIsolation isolation : values()) {
log.info("Test tx [concurrency=" + concurrency + ", isolation=" + isolation + ']');
for (int i = 0; i < 50; i++) {
final int k = key++;
checkReadThrough(cache, new IgniteRunnable() {
@Override
public void run() {
cache.invoke(k, new TestEntryProcessor());
}
}, concurrency, isolation, 2);
}
}
}
}
}
ignite0.cache(ccfg.getName()).removeAll();
} finally {
ignite0.destroyCache(ccfg.getName());
}
}
use of org.apache.ignite.transactions.TransactionIsolation in project ignite by apache.
the class IgniteTxStoreExceptionAbstractSelfTest method testPutBackupTx.
/**
* @throws Exception If failed.
*/
public void testPutBackupTx() throws Exception {
for (TransactionConcurrency concurrency : TransactionConcurrency.values()) {
for (TransactionIsolation isolation : TransactionIsolation.values()) {
checkPutTx(true, concurrency, isolation, keyForNode(grid(0).localNode(), BACKUP));
checkPutTx(false, concurrency, isolation, keyForNode(grid(0).localNode(), BACKUP));
}
}
}
use of org.apache.ignite.transactions.TransactionIsolation in project ignite by apache.
the class IgniteTxStoreExceptionAbstractSelfTest method testPutPrimaryTx.
/**
* @throws Exception If failed.
*/
public void testPutPrimaryTx() throws Exception {
for (TransactionConcurrency concurrency : TransactionConcurrency.values()) {
for (TransactionIsolation isolation : TransactionIsolation.values()) {
checkPutTx(true, concurrency, isolation, keyForNode(grid(0).localNode(), PRIMARY));
checkPutTx(false, concurrency, isolation, keyForNode(grid(0).localNode(), PRIMARY));
}
}
}
use of org.apache.ignite.transactions.TransactionIsolation in project ignite by apache.
the class WithKeepBinaryCacheFullApiTest method testInvokeAllTx.
/**
* @throws Exception If failed.
*/
@SuppressWarnings("serial")
public void testInvokeAllTx() throws Exception {
if (!txShouldBeUsed())
return;
for (TransactionConcurrency conc : TransactionConcurrency.values()) {
for (TransactionIsolation isolation : TransactionIsolation.values()) {
checkInvokeAllTx(conc, isolation);
jcache().removeAll();
}
}
}
Aggregations