Search code examples
javacachingstoredistributedgridgain

GridGain Cache putX returns success but no entries in cache


I am trying to load a java object into the GridGain cache (partitioned). I am using the command line visor to inspect the cache. And it shows that there are writes and misses (running just the cache command) but there are no entries.

I have tried storing (Integer, String) pairs into the cache using GridDataLoader interface, cache.put, and batch put and it works, I can see the entries via the visor. But I cannot do store a custom java Object

I tried out org.gridgain.examples.CacheQueryExample as well, and don't quite understand how it stores the entries in the cache yet it visorcmd (command line visor) reports that there are no entries.

I tried using the GridDataLoader, cache put and batch catch put which all return without errors (or success status if applicable, such as with cache.put()) but I see no entries in the partitioned cache when inspecting via the commandline visor


Solution

  • I think you are experiencing the case of peer-class-loading and automatic undeploy whenever the source node for class loading leaves. This is a desired behavior given your configuration, but I think the message in the node log should reflect that (I have already mentioned it to the GridGain team)

    Several ways to avoid it:

    1. Start your node from IDE, so all the classes are in the classpath on all the nodes.
    2. Copy your JAR file into the libs folder of GridGain installation. This way the classes will again be on all the nodes and peer-class-loading will not be used.
    3. Change deployment mode in configuration from SHARED to CONTINUOUS, in which case GridGain will not automatically undeploy the classes, but also will not automatically deploy new classes whenever you make changes while developing.