Re: [osgi-dev] OSGi and Java 11 ?
Eclipse itself supports running on Java 11 with its latest release which includes running on top of Equinox. OSGi Frameworks should be able to continue to work on Java 11 and future versions of Java. Tom - Original message -From: Cristiano via osgi-dev Sent by: osgi-dev-boun...@mail.osgi.orgTo: OSGi Developer Mail List Cc:Subject: [osgi-dev] OSGi and Java 11 ?Date: Mon, Oct 29, 2018 1:04 PM Hello all,I'm reading about the recently release of the long-term Java11 and sawthat it have many differences from the java8, mainly its modules system.So, anyone have already tried java11 in an OSGi based development env ?and/or have tried a migration of an existent OSGi based application(felix or equinox) from java8 to java11 ?thanks,Cristiano___OSGi Developer Mail Listosgi-dev@mail.osgi.orghttps://mail.osgi.org/mailman/listinfo/osgi-dev ___ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev
[osgi-dev] OSGi and Java 11 ?
Hello all, I'm reading about the recently release of the long-term Java11 and saw that it have many differences from the java8, mainly its modules system. So, anyone have already tried java11 in an OSGi based development env ? and/or have tried a migration of an existent OSGi based application (felix or equinox) from java8 to java11 ? thanks, Cristiano ___ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev
Re: [osgi-dev] Converting CompletableFuture to Promise
Thanks Tim, I had actually put together a version almost similar using whenComplete. I must be starting to get the hang of it ;), but I must still admit that your implementation addresses a few holes in mine. Alain On Mon, Oct 29, 2018 at 5:58 AM Tim Ward wrote: > Hi Alain, > > Unsurprisingly this isn’t very hard to do: > > private PromiseFactory pf; > > public Promise toPromise(CompletionStage cs) { > Deferred deferred = pf.deferred(); > cs.whenComplete((r,e) -> { > if(e == null) { > deferred.resolve(r); > } else { > deferred.fail(e); > } > }); > return deferred.getPromise(); > } > > public Promise toPromise(CompletableFuture cf) { > if(cf.isDone() && !cf.isCompletedExceptionally()) { > return pf.resolved(cf.getNow(null)); > } else { > return toPromise((CompletionStage) cf); > } > } > > Note that the CompletableFuture version is just a way to optimise when the > Completable Future is already successfully resolved (the API for consuming > failures is so bad that it’s not worth trying to optimise the already > failed case). > > Best Regards, > > Tim > > On 28 Oct 2018, at 15:41, Alain Picard via osgi-dev < > osgi-dev@mail.osgi.org> wrote: > > We are now using Promises all over the place, but we are finding ourselves > using a library that uses CompletableFuture and want our service based on > that library to convert those futures into promises. > > Has anyone done this before? While I can surely find a way of doing it, I > would like to get some best practice advice from the experts. > > Cheers, > Alain > > ___ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev > > > ___ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev
Re: [osgi-dev] Converting CompletableFuture to Promise
Hi Alain, Unsurprisingly this isn’t very hard to do: private PromiseFactory pf; public Promise toPromise(CompletionStage cs) { Deferred deferred = pf.deferred(); cs.whenComplete((r,e) -> { if(e == null) { deferred.resolve(r); } else { deferred.fail(e); } }); return deferred.getPromise(); } public Promise toPromise(CompletableFuture cf) { if(cf.isDone() && !cf.isCompletedExceptionally()) { return pf.resolved(cf.getNow(null)); } else { return toPromise((CompletionStage) cf); } } Note that the CompletableFuture version is just a way to optimise when the Completable Future is already successfully resolved (the API for consuming failures is so bad that it’s not worth trying to optimise the already failed case). Best Regards, Tim > On 28 Oct 2018, at 15:41, Alain Picard via osgi-dev > wrote: > > We are now using Promises all over the place, but we are finding ourselves > using a library that uses CompletableFuture and want our service based on > that library to convert those futures into promises. > > Has anyone done this before? While I can surely find a way of doing it, I > would like to get some best practice advice from the experts. > > Cheers, > Alain > > ___ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev ___ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev