Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0465D200C44 for ; Mon, 27 Mar 2017 15:20:57 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 02E9D160B5D; Mon, 27 Mar 2017 13:20:57 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 20721160B85 for ; Mon, 27 Mar 2017 15:20:55 +0200 (CEST) Received: (qmail 60216 invoked by uid 500); 27 Mar 2017 13:20:55 -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 60204 invoked by uid 99); 27 Mar 2017 13:20:55 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Mar 2017 13:20:54 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 969041A0109 for ; Mon, 27 Mar 2017 13:20:54 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.379 X-Spam-Level: *** X-Spam-Status: No, score=3.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_REPLY=1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 8hq0I-1botaV for ; Mon, 27 Mar 2017 13:20:52 +0000 (UTC) Received: from mail-vk0-f41.google.com (mail-vk0-f41.google.com [209.85.213.41]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 12E2A5FAD2 for ; Mon, 27 Mar 2017 13:20:52 +0000 (UTC) Received: by mail-vk0-f41.google.com with SMTP id s68so50842312vke.3 for ; Mon, 27 Mar 2017 06:20:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=8fJLqku5kFZ6SwUsRB1N82Sy2ODQsqTvvSx6db1ADR4=; b=mtdHLbb6m0GjSLvLZ/ZMhXkUA+zsYLI8iJKKYevJjCsxRBjLij/3/TBL0v0yu4UQaW EExcJcaXvDJQKmWZhU/+ehF3SSqryMcXMdC0FiBGWpBW4a14lsbi8yn4cZvOy5XjfdN1 zyMfO+NPtyBUF06c+USpMtGyokoLSpE7XAgk2Lf/TrKiRxIjFc9dsgJaPqxEQCzRL1U7 wtap7R49h/d43FTgRWnPMap8+k+BtcNS9fsJJgn0nKc3w91VsaUKtOjoAmbVNqOY0Yip 80oVoS6Jw6tv3XBpHMU+DoiApXz1G57sHFSyIRKDEFOVNfLbtOkGoYrhgO0pSCtJh2/p 212Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=8fJLqku5kFZ6SwUsRB1N82Sy2ODQsqTvvSx6db1ADR4=; b=NT1nu6yiQI5XWsg/0JumD5ujLOqBgrnZlrvoQ61+SPBWrAF1tTWjkuuX4koi0yHQJT FpxagTuSKcFmauwa0OMuFwJaDN/DHFDI7kKEoBK/mTlSIUwSHHD/ugr4+w/p9O0wej6k TrTr/u3yoiGibK/9hXr1rVJHTpU75TPkGGIWHTbQx+sxhqyf79ewiOB7o5igTygF0je8 t1cyXuL8nzyaqGzpQX+4O8fkE/8rci15RInKSz0xkbcrGL2kClISPvTl9Tz54PBNOc9z p24N2Dar1Os0zx6Mx+feoIqpTyndKNMCd3C3oGbB5dEoq/stnb+BFkelmRPyFxhzuobw vLFg== X-Gm-Message-State: AFeK/H15BOUpIN14RJXG2Re0n7XTwYiA5gRmytWV/hUUIeMiKmRX+ZyRRgqDH2+N2O2EqOV+O5tvGxiqGg1yHQ== X-Received: by 10.31.178.203 with SMTP id b194mr7910607vkf.104.1490620472938; Mon, 27 Mar 2017 06:14:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Sergei Egorov Date: Mon, 27 Mar 2017 13:14:22 +0000 Message-ID: Subject: Re: IgniteFuture adapters To: dev@ignite.apache.org Content-Type: multipart/alternative; boundary=001a1143f990c8d9a4054bb61f54 archived-at: Mon, 27 Mar 2017 13:20:57 -0000 --001a1143f990c8d9a4054bb61f54 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable True, I just prefer functional style over static methods. Regarding "why should this method be a part of the future API" - why not? It helps to chain such calls instead of call nesting. Of course, if Java had extension methods it wouldn't be needed, but we don't have them. On Mon, Mar 27, 2017 at 4:06 PM Alexey Goncharuk wrote: > Sergei, > > Why should this method be a part of the future API? The only implementati= on > will do "return func(this);" > > I can achieve the same result the following way: > rx(compute.runAsync(runnable)).timeout(5_000).subscribe(); > > > > 2017-03-27 15:54 GMT+03:00 Sergei Egorov : > > > Take a look at my initial code. > > > > public IgniteFuture chain(IgniteClosure > IgniteFuture, T> doneCb); > > > > vs > > > > public R to(IgniteClosure, R> transformer); > > > > > > The result of "chain" is IgniteFuture. > > > > The result of "to" is the object returned from transformer. It would > > be CompletableFuture, Rx's Observable, Reactor's Mono, etc... > > > > > > On Mon, Mar 27, 2017 at 3:18 PM =D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0= =B9 =D0=A0=D1=8F=D0=B1=D0=BE=D0=B2 > > wrote: > > > > > Em... When you get result of your future, closure will produce new > future > > > with completely different type. > > > > > > 2017-03-27 13:43 GMT+03:00 Sergei Egorov : > > > > > > > It doesn't :) > > > > > > > > It returns another IgniteFuture where I want to transform it to > > > completely > > > > different type. > > > > > > > > On Mon, Mar 27, 2017 at 1:41 PM =D0=94=D0=BC=D0=B8=D1=82=D1=80=D0= =B8=D0=B9 =D0=A0=D1=8F=D0=B1=D0=BE=D0=B2 > > > > > wrote: > > > > > > > > > IgniteFuture have method > > > > > > > > > > public IgniteFuture chain(IgniteClosure > IgniteFuture, > > > > T> > > > > > doneCb); > > > > > > > > > > which do this. > > > > > > > > > > 2017-03-27 13:30 GMT+03:00 Sergei Egorov : > > > > > > > > > > > Hi! > > > > > > > > > > > > Would be nice if igniteFuture would provide a small but very > usable > > > > > method: > > > > > > > > > > > > public R to(Function, R> transformer) > > > > > > > > > > > > it will allow to chain it like: > > > > > > > > > > > > > compute.runAsync(runnable).to(rx()).timeout(5_000).subscribe() > > > > > > > > > > > > Where rx() is just a static function with something like: > > > > > > > > > > > > public static Function, Observable> > rx() > > > > > > > > > > > > > > > > > > WDYT? > > > > > > > > > > > > > > > > > > > > > 2017-03-27 13:30 GMT+03:00 Sergei Egorov : > > > > > > > > > > > Hi! > > > > > > > > > > > > Would be nice if igniteFuture would provide a small but very > usable > > > > > method: > > > > > > > > > > > > public R to(Function, R> transformer) > > > > > > > > > > > > it will allow to chain it like: > > > > > > > > > > > > > compute.runAsync(runnable).to(rx()).timeout(5_000).subscribe() > > > > > > > > > > > > Where rx() is just a static function with something like: > > > > > > > > > > > > public static Function, Observable> > rx() > > > > > > > > > > > > > > > > > > WDYT? > > > > > > > > > > > > > > > > > > > > > --001a1143f990c8d9a4054bb61f54--