Hi,

    How to do for static EntryProcessor?

    I don't understand this clearly. Can you give me some code example?

    Thanks very much.



bob
 
From: Vladislav Pyatkov
Date: 2016-08-25 17:09
To: [email protected]
Subject: Re: Re: null exception about EntryProcessor
Hi,

I think, so it doesn't always lead to exception, but you need to do it for 
prevent issues of serialization.
Is static EntryProcessor allow to avoid NPE exception in your case?

On Thu, Aug 25, 2016 at 3:56 AM, 胡永亮/Bob <[email protected]> wrote:
hi Alexey,
This is example from official website. No static EntryProcessor.
IgniteCache<String, Integer> cache = ignite.jcache("mycache");
// Increment cache value 10 times.
for (int i = 0; i < 10; i++)
  cache.invoke("mykey", new EntryProcessor<String, Integer, Void>() {
    @Override 
    public Object process(MutableEntry<Integer, String> entry, Object... args) {
      Integer val = entry.getValue();
      entry.setValue(val == null ? 1 : val + 1);
      return null;
    }
  });



胡永亮
 

 
From: Alexey Goncharuk
Date: 2016-08-25 02:10
To: [email protected]
Subject: Re: null exception about EntryProcessor
Hi,

You need to make your EntryProcessor a static class, otherwise it captures a 
reference to your enclosing class which causes the serialization exception.

2016-08-24 17:54 GMT+03:00 Vladislav Pyatkov <[email protected]>:
Hello,

Could you please provide reproduced example?

On Wed, Aug 24, 2016 at 11:04 AM, 胡永亮/Bob <[email protected]> wrote:
hi, everyone:
    
    When I use EntryProcessor to update value in remote node, the statement 
entry.getValue() throwed null exception. The log detail is in the attachement 
file log.txt.
    I don't know why.

    I first do a check with the statement cache.containsKey(key), if it is 
true, then do the EntryProcessor. Why null exception happened?
    
if (cache.containsKey(key)) {
//                    Map<String, maplink> map = cache.get(key);
//                    map.put(mapLink.seclinkID.linkID + "_" + 
mapLink.seclinkID.dir, mapLink);
//                    cache.put(key, map);
line 122                    cache.invoke(key, new 
EntryProcessor<MapMeshLinkKey,Map<String,maplink>, Void>() {
                        @Override 
                        public Void 
process(MutableEntry<MapMeshLinkKey,Map<String,maplink>> entry, Object... args) 
{
line 125                            Map<String,maplink> map = entry.getValue();
                            map.put(mapLink.seclinkID.linkID + "_" + 
mapLink.seclinkID.dir, mapLink);
                            entry.setValue(map);
                            return null;
                        }
                    });
                    ENTRY_COUNT++;
                }

Can anyone help me, or meet this problem? Thanks your reply.



胡永亮
 


---------------------------------------------------------------------------------------------------
Confidentiality Notice: The information contained in this e-mail and any 
accompanying attachment(s) 
is intended only for the use of the intended recipient and may be confidential 
and/or privileged of 
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of 
this communication is 
not the intended recipient, unauthorized use, forwarding, printing,  storing, 
disclosure or copying 
is strictly prohibited, and may be unlawful.If you have received this 
communication in error,please 
immediately notify the sender by return e-mail, and delete the original message 
and all copies from 
your system. Thank you. 
---------------------------------------------------------------------------------------------------



-- 
Vladislav Pyatkov


---------------------------------------------------------------------------------------------------
Confidentiality Notice: The information contained in this e-mail and any 
accompanying attachment(s) 
is intended only for the use of the intended recipient and may be confidential 
and/or privileged of 
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of 
this communication is 
not the intended recipient, unauthorized use, forwarding, printing,  storing, 
disclosure or copying 
is strictly prohibited, and may be unlawful.If you have received this 
communication in error,please 
immediately notify the sender by return e-mail, and delete the original message 
and all copies from 
your system. Thank you. 
---------------------------------------------------------------------------------------------------



-- 
Vladislav Pyatkov


---------------------------------------------------------------------------------------------------
Confidentiality Notice: The information contained in this e-mail and any 
accompanying attachment(s)
is intended only for the use of the intended recipient and may be confidential 
and/or privileged of
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of 
this communication is
not the intended recipient, unauthorized use, forwarding, printing,  storing, 
disclosure or copying
is strictly prohibited, and may be unlawful.If you have received this 
communication in error,please
immediately notify the sender by return e-mail, and delete the original message 
and all copies from
your system. Thank you.
---------------------------------------------------------------------------------------------------

Reply via email to