ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ilya Kasnacheev <ilya.kasnach...@gmail.com>
Subject Re: update Object type value of entry in EntryProcessor within transaction does not work
Date Mon, 21 Jan 2019 11:41:56 GMT
Hello!

I was able to run your first & second fragments with expected behavior:

Entity{id='hello3', value='v3', date=2019-01-21}

Note that I'm using 2.7.

Regards,
-- 
Ilya Kasnacheev


пн, 21 янв. 2019 г. в 08:43, c c <yeahch2011@gmail.com>:

> Hi,
>   I work on ignite 2.7.0
>
>   I have a value type as below
>
> public class Entity {
>      String id;
>      String value;
>      Date date;
> }
>
> then interact with cache as below
>
> try (Transaction tx =
>      ignite.transactions().txStart(TransactionConcurrency.PESSIMISTIC,
> TransactionIsolation.SERIALIZABLE)) {
>      cache1.invoke("k6", new EntryProcessor<String, Entity, Object>() {
>      @Override     public Object process(MutableEntry<String, Entity>
> mutableEntry, Object... objects) throws EntryProcessorException {
>      Entity e = mutableEntry.getValue();
>     e.setId("hello3");
>     e.setValue("v3");
>     mutableEntry.setValue(e);
>     return null;
> }
> });
>     tx.commit();
> }
>
> But entry value does not change after commit.
>
> If i code as below, entry value would change after commit.
>
> try (Transaction tx =
>      ignite.transactions().txStart(TransactionConcurrency.PESSIMISTIC,
> TransactionIsolation.SERIALIZABLE)) {
>      cache1.invoke("k6", new EntryProcessor<String, Entity, Object>() {
>      @Override     public Object process(MutableEntry<String, Entity>
> mutableEntry, Object... objects) throws EntryProcessorException {
>     mutableEntry.setValue(new Entity("test2", "a2", new Date()));
>     return null;
> }
> });
>     tx.commit();
> }
>
> I found that changes to entry would not take effect after commit when
> mutableEntry.getValue() called.
>

Mime
View raw message