views:

978

answers:

6
+4  Q: 

Twisted in Java

What is the closest Java alternative to Twisted?

+1  A: 

I don't think there is anything quite like Twisted, as far as Deferreds and complex callback chains go. For non-blocking IO, I think NIO is the most commonly-used solution. In particular, look at this section on Selectors.

DNS
+3  A: 

Nio is really low level and supports Socket only and SSL if you dig hard enough on Google for samples.

Apache Mina wraps the complexity and adds a few protocols but not as much as Twister.

+2  A: 

Like Stephane, I would suggest you take a look at Mina. Its a framework for asynchronous network IO. It is built on top of NIO, which was mentioned earlier, and IMO hides away some of the complexity involved with Selectors,Channels,etc.. I've used Mina for a couple of projects and its pretty good, but be warned, I've found the documentation to be a little weak. And again, like Stephane mentioned, it doesn't have out of the box support for too many protocols.

nstehr
+1  A: 

I've implemented most of a Twisted reactor in my collection of AMP hacks on launchpad - but it needs a maintainer.

Glyph
+1  A: 

If there is still an interest in this, I've just put up the first beta release of the 'Reaction' framework, which supports the Twisted-style deferred callback model in Java. As well as working as a standard Java package, it can also be used as an OSGi service. License is Apache version 2.

More details on my website, >here<.

A: 

I suspect that Glyph's response is the most pedantically authoritative, being THE twisted author and all.

/me goes off to look at Mina...

Enki