Return-Path: X-Original-To: apmail-ignite-dev-archive@minotaur.apache.org Delivered-To: apmail-ignite-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 540EB18747 for ; Fri, 9 Oct 2015 14:22:45 +0000 (UTC) Received: (qmail 38390 invoked by uid 500); 9 Oct 2015 14:22:45 -0000 Delivered-To: apmail-ignite-dev-archive@ignite.apache.org Received: (qmail 38350 invoked by uid 500); 9 Oct 2015 14:22:45 -0000 Mailing-List: contact dev-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list dev@ignite.apache.org Received: (qmail 38339 invoked by uid 99); 9 Oct 2015 14:22:44 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Oct 2015 14:22:44 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 6A4E7180A3F for ; Fri, 9 Oct 2015 14:22:44 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.998 X-Spam-Level: ** X-Spam-Status: No, score=2.998 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=3, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id ntN24vbCbAkj for ; Fri, 9 Oct 2015 14:22:43 +0000 (UTC) Received: from mail-qg0-f52.google.com (mail-qg0-f52.google.com [209.85.192.52]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 996BC2315E for ; Fri, 9 Oct 2015 14:22:42 +0000 (UTC) Received: by qgx61 with SMTP id 61so69725602qgx.3 for ; Fri, 09 Oct 2015 07:22:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=coCRl4z9oNPMfe6Yj08HGa4trm6UAC8zwlNvsghhhg8=; b=Atz8KwiVZdo0mQ5g9V8PLZkDW7auK33dRiCHT6FLSngZHkK3RTHtopU54fzZPSz+AL 8J8NJRnjSYWTZ2ls6lDCTEWLS6hLPDyZX6GKL3atdIaIzEtD4uHX2lqJ+wjEeuDYIiQL Mu/u+OeGbGk49YF+jbsW/NxeonB4ed5NNUoMY/HwuieaaPzMeKRXACt7HIiZoB+XQ0Vc k0I68/x/dDmNaJDz5xDMy4QWcLQxwdS1ERW0yhIDDy/WGN9kmtPfeKDHUflMKCoZ61G9 k2XO521Fjb4mw/CRQR1/sj1zNigr1ikzyRWNMvzJyiyNDQly+RNh7pq/3EgnLxn7TfhU JLww== X-Gm-Message-State: ALoCoQnl1KZEhSulYrf5jaNNiuhpqwfVeZ/S413Dzx5TdZ3sEdGD+QjJBWXVMW/B0EC0uNhtR3TV MIME-Version: 1.0 X-Received: by 10.140.132.209 with SMTP id 200mr16459435qhe.64.1444400556224; Fri, 09 Oct 2015 07:22:36 -0700 (PDT) Received: by 10.140.20.167 with HTTP; Fri, 9 Oct 2015 07:22:36 -0700 (PDT) Date: Fri, 9 Oct 2015 17:22:36 +0300 Message-ID: Subject: Which thread is used to run IgniteFuture continuations? From: Vladimir Ozerov To: dev@ignite.apache.org Content-Type: multipart/alternative; boundary=001a11c07cca1153610521acb62a --001a11c07cca1153610521acb62a Content-Type: text/plain; charset=UTF-8 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 callback, Executor executor); Looks like we should allow users to specify optional thread pool in futures likewise. Thoughts? Vladimir. --001a11c07cca1153610521acb62a--