ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Cote <sc...@etcc.com>
Subject FW: class loading, peer class loading, jars, fun times in ignite
Date Tue, 28 May 2019 20:35:05 GMT
Whoops - sent to the wrong list ...

From: Scott Cote
Sent: Tuesday, May 28, 2019 1:04 PM
To: dev@ignite.apache.org
Subject: class loading, peer class loading, jars, fun times in ignite

I am fairly certain that I don't know how to use peer class loading properly.

Am using Apache Ignite 2.7.  If I have a node running on 192.168.1.2 with a peer class loading
enabled, and I start up a second node - 192.168.1.3, client mode enabled and peer class loading
enabled, then I expected the following:

Running the snippet (based on https://apacheignite.readme.io/docs/getting-started#section-first-ignite-data-grid-application
) on the client (192.168.1.3):

try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
    IgniteCache<Integer, MyWrapperOfString> cache = ignite.getOrCreateCache("myCacheName");

    // Store keys in cache (values will end up on different cache nodes).
    for (int i = 0; i < 10; i++)
        cache.put(i,new MyWrapperOfString( Integer.toString(i)));

    for (int i = 0; i < 10; i++)
        System.out.println("Got [key=" + i + ", val=" + cache.get(i) + ']');
}


Would cause the cache of "MyWrapperOfString" instances to be available on 192.168.1.2 and
on 192.168.1.3 .   Also be able to observe the cache using visor, etc ....

However - I instead get an error that the class "MyWrapperOfString" is not available on 192.168.1.2.
  Now if I take the jar that the class is packed, and place it in the lib folder, all is happy.

Should I have to do this?
If yes - how do I update the jar if I have a cluster of nodes doing this?   Do I have to shutdown
the entire cluster in order to not have class loader problems?
I thought the peer class loading is supposed to solve this problem.

I think it would be VERY INSTRUCTIVE for the snippet that I anchored to not use a standard
java library cache object, but to demonstrate the need to package value object into a jar
and stuff it into the lib folder (If this is what is expected).     Running lambdas that use
basic java primitives is cool, but is this the normal?

Switching up .... Is there interest in me creating class loader that would load java classes
into the vm that could be incorporated into ignite?   So instead of reading a jar, you load
the class bytes into a cache .  You want to hot load a new class?  Fine ! pump into the DISTRIBUTED_CLASS_PATH_CACHE
.

Cheers.

SCott


Mime
View raw message