Igniters,
I received the following proposal in my blog. I think this is useful. Any thoughts? Please extend IgniteFuture by conversion method to CompletableFuture. I > bored to write something like this: > asyncCache.invoke(key, entryProcessor); > CompletableFuture completableFuture = new CompletableFuture<>(); > IgniteFuture igniteFuture = asyncCache.future(); > IgniteInClosure> listener = (IgniteInClosure>) completedIgniteFuture -> { > Throwable exception = null; > T result = null; > try { > result = completedIgniteFuture.get(); > } catch (Throwable t) { > exception = t; > } > if (exception != null) { > completableFuture.completeExceptionally(exception); > } else { > completableFuture.complete(result); > } > }; > igniteFuture.listen(listener); > return completableFuture; |
CompletableFuture is part of java 8.
--Yakov 2017-08-31 4:46 GMT+03:00 Dmitriy Setrakyan <[hidden email]>: > Igniters, > > I received the following proposal in my blog. I think this is useful. Any > thoughts? > > Please extend IgniteFuture by conversion method to CompletableFuture. I > > bored to write something like this: > > > > asyncCache.invoke(key, entryProcessor); > > CompletableFuture completableFuture = new CompletableFuture<>(); > > IgniteFuture igniteFuture = asyncCache.future(); > > IgniteInClosure> listener = (IgniteInClosure>) completedIgniteFuture -> { > > Throwable exception = null; > > T result = null; > > try { > > result = completedIgniteFuture.get(); > > } catch (Throwable t) { > > exception = t; > > } > > if (exception != null) { > > completableFuture.completeExceptionally(exception); > > } else { > > completableFuture.complete(result); > > } > > }; > > igniteFuture.listen(listener); > > return completableFuture; > |
Is it still actual to support java 7?
On Thu, Aug 31, 2017 at 11:03 AM, Yakov Zhdanov <[hidden email]> wrote: > CompletableFuture is part of java 8. > > --Yakov > > 2017-08-31 4:46 GMT+03:00 Dmitriy Setrakyan <[hidden email]>: > > > Igniters, > > > > I received the following proposal in my blog. I think this is useful. Any > > thoughts? > > > > Please extend IgniteFuture by conversion method to CompletableFuture. I > > > bored to write something like this: > > > > > > > asyncCache.invoke(key, entryProcessor); > > > CompletableFuture completableFuture = new CompletableFuture<>(); > > > IgniteFuture igniteFuture = asyncCache.future(); > > > IgniteInClosure> listener = (IgniteInClosure>) completedIgniteFuture > -> { > > > Throwable exception = null; > > > T result = null; > > > try { > > > result = completedIgniteFuture.get(); > > > } catch (Throwable t) { > > > exception = t; > > > } > > > if (exception != null) { > > > completableFuture.completeExceptionally(exception); > > > } else { > > > completableFuture.complete(result); > > > } > > > }; > > > igniteFuture.listen(listener); > > > return completableFuture; > > > |
In reply to this post by yzhdanov
+1 for migrating to java 8.
Sincerely, Dmitriy Pavlov On чт, 31 авг. 2017 г., 11:03 Yakov Zhdanov <[hidden email]> wrote: > CompletableFuture is part of java 8. > > --Yakov > > 2017-08-31 4:46 GMT+03:00 Dmitriy Setrakyan <[hidden email]>: > > > Igniters, > > > > I received the following proposal in my blog. I think this is useful. Any > > thoughts? > > > > Please extend IgniteFuture by conversion method to CompletableFuture. I > > > bored to write something like this: > > > > > > > asyncCache.invoke(key, entryProcessor); > > > CompletableFuture completableFuture = new CompletableFuture<>(); > > > IgniteFuture igniteFuture = asyncCache.future(); > > > IgniteInClosure> listener = (IgniteInClosure>) completedIgniteFuture > -> { > > > Throwable exception = null; > > > T result = null; > > > try { > > > result = completedIgniteFuture.get(); > > > } catch (Throwable t) { > > > exception = t; > > > } > > > if (exception != null) { > > > completableFuture.completeExceptionally(exception); > > > } else { > > > completableFuture.complete(result); > > > } > > > }; > > > igniteFuture.listen(listener); > > > return completableFuture; > > > |
There is no need to migrate to Java 8 to support CompletableFuture. Create
separate Maven project and compile it with Java 8 - this is it. On Thu, Aug 31, 2017 at 3:28 PM, Dmitry Pavlov <[hidden email]> wrote: > +1 for migrating to java 8. > > Sincerely, > Dmitriy Pavlov > > > On чт, 31 авг. 2017 г., 11:03 Yakov Zhdanov <[hidden email]> wrote: > > > CompletableFuture is part of java 8. > > > > --Yakov > > > > 2017-08-31 4:46 GMT+03:00 Dmitriy Setrakyan <[hidden email]>: > > > > > Igniters, > > > > > > I received the following proposal in my blog. I think this is useful. > Any > > > thoughts? > > > > > > Please extend IgniteFuture by conversion method to CompletableFuture. I > > > > bored to write something like this: > > > > > > > > > > asyncCache.invoke(key, entryProcessor); > > > > CompletableFuture completableFuture = new CompletableFuture<>(); > > > > IgniteFuture igniteFuture = asyncCache.future(); > > > > IgniteInClosure> listener = (IgniteInClosure>) completedIgniteFuture > > -> { > > > > Throwable exception = null; > > > > T result = null; > > > > try { > > > > result = completedIgniteFuture.get(); > > > > } catch (Throwable t) { > > > > exception = t; > > > > } > > > > if (exception != null) { > > > > completableFuture.completeExceptionally(exception); > > > > } else { > > > > completableFuture.complete(result); > > > > } > > > > }; > > > > igniteFuture.listen(listener); > > > > return completableFuture; > > > > > > |
Agree. Vladimir's suggestions should work.
We cannot drop Java7 now. --Yakov |
In reply to this post by Vladimir Ozerov
On Thu, Aug 31, 2017 at 3:39 PM, Vladimir Ozerov <[hidden email]>
wrote: > There is no need to migrate to Java 8 to support CompletableFuture. Create > separate Maven project and compile it with Java 8 - this is it. > Vova, I am not sure I understand. How will it be released? > > On Thu, Aug 31, 2017 at 3:28 PM, Dmitry Pavlov <[hidden email]> > wrote: > > > +1 for migrating to java 8. > > > > Sincerely, > > Dmitriy Pavlov > > > > > > On чт, 31 авг. 2017 г., 11:03 Yakov Zhdanov <[hidden email]> wrote: > > > > > CompletableFuture is part of java 8. > > > > > > --Yakov > > > > > > 2017-08-31 4:46 GMT+03:00 Dmitriy Setrakyan <[hidden email]>: > > > > > > > Igniters, > > > > > > > > I received the following proposal in my blog. I think this is useful. > > Any > > > > thoughts? > > > > > > > > Please extend IgniteFuture by conversion method to > CompletableFuture. I > > > > > bored to write something like this: > > > > > > > > > > > > > asyncCache.invoke(key, entryProcessor); > > > > > CompletableFuture completableFuture = new CompletableFuture<>(); > > > > > IgniteFuture igniteFuture = asyncCache.future(); > > > > > IgniteInClosure> listener = (IgniteInClosure>) > completedIgniteFuture > > > -> { > > > > > Throwable exception = null; > > > > > T result = null; > > > > > try { > > > > > result = completedIgniteFuture.get(); > > > > > } catch (Throwable t) { > > > > > exception = t; > > > > > } > > > > > if (exception != null) { > > > > > completableFuture.completeExceptionally(exception); > > > > > } else { > > > > > completableFuture.complete(result); > > > > > } > > > > > }; > > > > > igniteFuture.listen(listener); > > > > > return completableFuture; > > > > > > > > > > |
We can build project using java 8 partially for java 7 and partially for
java 8 (target bytecode version). I guess for end user it will be something like 2 artifacts to be dependent from - group: 'org.apache.ignite', name: 'ignite-core', version: '2.3' - group: 'org.apache.ignite', name: 'ignite-core8', version: '2.3' Am I right? But what will we do with ignite-core8 when we support Java8 in the long run пт, 1 сент. 2017 г. в 13:35, Dmitriy Setrakyan <[hidden email]>: > On Thu, Aug 31, 2017 at 3:39 PM, Vladimir Ozerov <[hidden email]> > wrote: > > > There is no need to migrate to Java 8 to support CompletableFuture. > Create > > separate Maven project and compile it with Java 8 - this is it. > > > > Vova, I am not sure I understand. How will it be released? > > > > > > On Thu, Aug 31, 2017 at 3:28 PM, Dmitry Pavlov <[hidden email]> > > wrote: > > > > > +1 for migrating to java 8. > > > > > > Sincerely, > > > Dmitriy Pavlov > > > > > > > > > On чт, 31 авг. 2017 г., 11:03 Yakov Zhdanov <[hidden email]> > wrote: > > > > > > > CompletableFuture is part of java 8. > > > > > > > > --Yakov > > > > > > > > 2017-08-31 4:46 GMT+03:00 Dmitriy Setrakyan <[hidden email]>: > > > > > > > > > Igniters, > > > > > > > > > > I received the following proposal in my blog. I think this is > useful. > > > Any > > > > > thoughts? > > > > > > > > > > Please extend IgniteFuture by conversion method to > > CompletableFuture. I > > > > > > bored to write something like this: > > > > > > > > > > > > > > > > asyncCache.invoke(key, entryProcessor); > > > > > > CompletableFuture completableFuture = new CompletableFuture<>(); > > > > > > IgniteFuture igniteFuture = asyncCache.future(); > > > > > > IgniteInClosure> listener = (IgniteInClosure>) > > completedIgniteFuture > > > > -> { > > > > > > Throwable exception = null; > > > > > > T result = null; > > > > > > try { > > > > > > result = completedIgniteFuture.get(); > > > > > > } catch (Throwable t) { > > > > > > exception = t; > > > > > > } > > > > > > if (exception != null) { > > > > > > completableFuture.completeExceptionally(exception); > > > > > > } else { > > > > > > completableFuture.complete(result); > > > > > > } > > > > > > }; > > > > > > igniteFuture.listen(listener); > > > > > > return completableFuture; > > > > > > > > > > > > > > > |
In reply to this post by dsetrakyan
>>Vova, I am not sure I understand. How will it be released?
This can be a module containing only java8 related stuff including method that converts IgniteFuture to completable future. And it should be built with java8. --Yakov |
Exactly.
On Fri, Sep 1, 2017 at 2:51 PM, Yakov Zhdanov <[hidden email]> wrote: > >>Vova, I am not sure I understand. How will it be released? > > This can be a module containing only java8 related stuff including method > that converts IgniteFuture to completable future. And it should be built > with java8. > > --Yakov > |
Free forum by Nabble | Edit this page |