Hi David,

Seems, this predicate called from sensitive code and cache creation end up
with deadlock.
Try to move cache creation to separate thread.

On Mon, May 15, 2017 at 11:44 AM, David Li <[email protected]> wrote:

> 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
> there.
>
> 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;
>     }
>
>     @Override
>     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.
>
> BRs,
>
> David
>
>
>


-- 
Best regards,
Andrey V. Mashenkov

Reply via email to