ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Li <david.li...@gmail.com>
Subject Cannot create cache in EVT_CLIENT_NODE_RECONNECTED event
Date Mon, 15 May 2017 08:44:55 GMT
Hi guys,

In the code snippet below, I am trying to re-create a cache after the
client node has disconnected and reconnected to the server node, somehow
the line of creating the cache cannot be executed, the program just hangs

public static class Predicate implements IgnitePredicate<DiscoveryEvent> {

    private Ignite ignite;
    private IgniteCache<Integer, String> cache;

    public Predicate(Ignite ignite, IgniteCache<Integer, String> cache) {
        this.ignite = ignite;
        this.cache = cache;

    public boolean apply(DiscoveryEvent evt) {
        // see this line in output
        System.out.println("Received event [evt=" + evt.name() + ",
type=" + evt.type());
        if (evt.type() == EventType.EVT_CLIENT_NODE_RECONNECTED) {
            // reinitialize all the caches
            cache = ignite.getOrCreateCache(CACHE_NAME);  // if debug,
program hangs here
            System.out.println("Initialised cache: " + CACHE_NAME);
// never see this in output
        return true;

Appreciate any ideas. Thanks.



View raw message