Skip to content


Subversion checkout URL

You can clone with
Download ZIP


java port of when.js #92

mikaelkaron opened this Issue · 2 comments

2 participants


We've been experimenting with vert-x (fully async polygot app framework) in our organization for a while, and one of the things that we've been missing is a way to do async code in java.

I've been a happy user of when.js for a while (even include it as a base module in troopjs) so we decided to try to port as much as possible of when.js to java. The preliminary results are available now as englishtown/promises (possibly to be renamed to in the future).

We have a few questions:

  • Would you be interested / could you take a look at the implementation?
  • When.js is released under MIT. We're going to release ours as MIT with attribution back to when.js and hope this is how this should be done.


Cool! I actually came across some chatter about your port on google groups--might have been in the vert.x group--but hadn't really had time to take a close look. It sounds very interesting. I haven't thought about what a promise implementation might look like in Java, so I'd def like to take a look at what you've done.

@unscriptable and I are doing a webinar on Thur (if you're at all interested in IOC in Javascript, feel free to check it out, so I'll be tied up until after that. I'll definitely look at it after that, though.

As for license/attribution, yeah, MIT with attribution will be just fine. MIT is quite open, and freely allows derivative works, copying, modifying, etc.

I'll ping back after I've had a chance to look at englishtown/promises


Hey @mikaelkaron

Since I'm totally fine with your releasing yours as MIT with attribution, I'm gonna close this issue, but let's continue to discuss here as much as we want :)

I did finally have a chance to look at the java version. Pretty wild! It's interesting to see the extensive use of generics to deal with the value vs. promise, and the multiple variants of each method to deal with when.js's heavy use of optional arguments. Is the approach working out well in practice? esp. the value vs. promise situation?

Have you been using it in a heavily multithreaded application yet? I'd be interested to hear how well non-blocking promises fit in vs. the standard Java Future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.