Adam Bien's Weblog

Java 8, Method Handles and Concurrency Utilities For Java EE

Java 8 with method handles enables direct execution of synchronous (legacy) code asynchronously within a managed thread pool:

Prepare your questions—I will attempt to answer them…live. See you soon!

See also other screencasts at: http://tv.adam-bien.com or subscribe to http://www.youtube.com/user/bienadam.

See you at Java EE Workshops at MUC Airport!


NEW workshop: Microservices with Java EE 7 and Java 8, January 26th, 2015, Airport Munich

A book about rethinking Java EE Patterns

Comments:

I can't believe you guys are so enthusiastic about function currying... This kind of functionality has been around for so long, it feels kinda silly to make a post about it. To me the post should be titled: Finally we can do some of the stuff that everybody else does, currying.

Posted by anonymous on April 18, 2014 at 08:16 PM CEST #

Hey Anonymous,

combination of Concurrency Utilities for Java EE JSR-236 and method handles is only possible since Java EE 7 applications are running on Java 8.

But you are right: most of the programming language features were already implemented in Lisp ...since 1958.

Nevertheless method handles are still useful in 2014,

thanks,

--adam

Posted by Adam Bien on April 19, 2014 at 04:16 AM CEST #

Hey, Anonymous:

Probably you come from some different background than Java EE and perhaps you misunderstood the post. To me, your judgement appears too harsh.

Consider that:

1. There is absolutely no currying happening in the example at all (why do you even mention it in your post? could it be that you are not clear about what "currying" is?);
2. Method references (as opposed to function pointers or simply first class functions), which could be considered a special case of a closure, are not that common in programming languages. They can be emulated by closing over "this" or "self" reference, but such solution comes with it's own problems (look at how Javascript's popular Backbone library references view methods in listener definitions - they are actually forced to use strings!).
3. The "excitement" is not about being able to reference a method, but how the method gets wrapped into a generic Callable, and how elegantly it fits into the new EE7 managed executor (which, in itself, is also a very nice thing, and not one readily available in non-java frameworks).

Posted by Filip on May 28, 2014 at 04:42 PM CEST #

Hi Adam. I'm just would like to know if you post your code samples to run and test somewere?
Especially for JEE7.0 stack.

Great job.

Thank you.

Posted by Dmitriy on June 29, 2014 at 08:39 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
...the last 150 posts
...the last 10 comments
License