Do cache instance retrieved from the same ignite instance ?

If not, fix it, cache must be retrieved this way : Ignition.ignite().cache("your_cache_name")


06.06.2018 15:32, ???????? ??????????:
I found some problems when I tried to use ignite transactions.
I expected that the transaction would commit alfter tx.commit();
but when I debugged my code step by step , changes had been already in effect before tx.commit();?? I also tried reading some source code of ignite transactions, but found no answer??
I guess I must make a stupid mistake.

Here is my code.

?0?2public static void withTransaction(Execute execute) throws Exception {
?0?2 ?0?2 ?0?2 ?0?2 try (Transaction tx = Ignition.ignite().transactions().txStart()) {
?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 execute.call();
?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 tx.commit();
?0?2 ?0?2 ?0?2 ?0?2 }
?0?2 ?0?2 }

public void call() throws Exception {
?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 Area area = new Area();
?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 area.cityId = 1l;
?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 area.name = "test";
?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ??
?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 cache.put(entity.id, entity);
?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ??
}


Reply via email to