ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitriy Setrakyan <dsetrak...@gridgain.com>
Subject Re: Which thread is used to run IgniteFuture continuations?
Date Fri, 09 Oct 2015 16:05:28 GMT
I will add +1 on this, which together with Andrey's +10, brings the total
to +11 :)

D.

On Fri, Oct 9, 2015 at 7:48 AM, Andrey Kornev <andrewkornev@hotmail.com>
wrote:

> Excellent idea! +10
> PS. Got burnt by this a few times already
>     _____________________________
> From: Vladimir Ozerov <vozerov@gridgain.com>
> Sent: Friday, October 9, 2015 4:22 PM
> Subject: Which thread is used to run IgniteFuture continuations?
> To:  <dev@ignite.apache.org>
>
>
>                    Igniters,
>
>  We are missing an ability to specify which thread should run continuation
>  routine when future is completed.
>
>  Currently we either run routine in the callee thread or in completion
>  thread (usually system pool thread). It means user cannot have any
> blocking
>  or cache operations inside the continuation. The code below could surprise
>  user with either a deadlock or system pool starvation:
>
>  final CountDownLatch latch = new CountDownLatch();
>
>  Cache cache = ignite.cache().withAsync();
>  cache.invoke(...);
>
>  cache.future().listen(() => {
>      latch.await();
>      /** Do something useful. */
>  });
>
>  /** Do something else. */
>  latch.countDown();
>
>  Java 8 and Hazelcast already support custom thread pools for
> continuations.
>  E.g.:
>  Hazelcast.CompletableFutureTask.andThen(ExecutionCallback<V> callback,
>  Executor executor);
>
>  Looks like we should allow users to specify optional thread pool in
> futures
>  likewise.
>
>  Thoughts?
>
>  Vladimir.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message