Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #29443
| From | Sebastian <news@seyweiler.dyndns.org> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Exception Handling in Asynchronous Java Code |
| Date | 2014-07-30 17:43 +0200 |
| Organization | albasani.net |
| Message-ID | <lrb3rl$2m3$1@news.albasani.net> (permalink) |
| References | <2e594246-2475-4b45-ae5e-2624b9a843d1@googlegroups.com> |
Am 30.07.2014 15:49, schrieb valerio.celletti@lightstreamer.com: > Hi All, > > Long time lurker, first time poster. I'd like to point your attention on an article we recently published on our company blog, titled "Exception Handling in Asynchronous Java Code" (link: http://blog.lightstreamer.com/2014/07/exception-handling-in-asynchronous-java.html). > > The article explains how to obtain the typical benefits of hierarchical exception handling and static exception checking even for event-driven programming or asynchronous programming. This can be achieved by writing code that follows a specific pattern and leans on a suitable support library. The same technique was applied in some parts of Lightstreamer (which is a real-time data streaming server written in Java) with proficiency. > > I'd like to hear your thoughts and feedbacks on above. What do you think? > > Thanks and regards, > Valerio > Very nice exposition. I'd like to add that with the advent of Java 8 there is a base for such frameworks already provided with the JDK, so it may be possible to get rid of much of the complexity of your current implementation. Java 8 contains java.util.concurrent.CompletableFuture<T>, a new class that represents a CompletionStage of a possibly asynchronous computation and provides many ways to bind some function to the result of an existing computation. The asynchronous chaining methods will use the common ForkJoin pool, otherwise you may provide an executor of your choice. Especially relevant with regard to the point of your presentation is the ability of CompletableFuture to completeExceptionally(), throwing an exception when the result of the computation is retrieved from the future. -- Sebastian PS: Here's a good intro to CompletableFuture: http://www.nurkiewicz.com/2013/05/java-8-definitive-guide-to.html
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Exception Handling in Asynchronous Java Code valerio.celletti@lightstreamer.com - 2014-07-30 06:49 -0700
Re: Exception Handling in Asynchronous Java Code Sebastian <news@seyweiler.dyndns.org> - 2014-07-30 17:43 +0200
Re: Exception Handling in Asynchronous Java Code dario.crivelli@lightstreamer.com - 2014-08-26 12:18 -0700
Re: Exception Handling in Asynchronous Java Code Sebastian <news@seyweiler.dyndns.org> - 2014-08-27 10:55 +0200
Re: Exception Handling in Asynchronous Java Code dario.crivelli@lightstreamer.com - 2014-08-27 13:36 -0700
csiph-web