In the code, tx.commit() is not reached. Is there a way to rollback the
cache.put("test1", "1"); cache.put("test2", "2");
public IgniteTest() {
CacheConfiguration cacheCfg = new CacheConfiguration();
cacheCfg.setName("cacheName");
cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setCacheConfiguration(cacheCfg);
TransactionConfiguration txCfg = new TransactionConfiguration();
cfg.setTransactionConfiguration(txCfg);
cfg.setClientMode(true);
Ignite ignite = Ignition.start(cfg);
transactions = ignite.transactions();
cache = ignite.getOrCreateCache("txn test cache");
}
public void run() {
Transaction tx =
transactions.txStart(TransactionConcurrency.OPTIMISTIC,
TransactionIsolation.SERIALIZABLE);
try{
cache.put("test1", "1");
cache.put("test2", "2");
String[] bug = null;
bug[0] = "hello";
cache.put("test3", "3");
System.out.println("tx.commit");
tx.commit();
}catch (Exception ex) {
ex.printStackTrace();
System.out.println("tx.rollback");
tx.rollback();
}
}
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/