Question

I'm learning how to use NIO to write a mud (I have not ruled out higher-level libraries, but I would like to learn the low-level operations as well).

In my reading I've learned about NIO2. Since I'm using Java 7 for this project already I'm wondering if the NIO operations I would use to write a single-threaded multiplexed server are not replaced in NIO2 -- that is, perhaps made simpler. As far as I can tell the relevant part of NIO2 for me are its asynchronous classes. However I'm not experienced enough to know if these are necessary or just a different/new abstraction that I don't necessarily need in place of a basic multiplexer.

Was it helpful?

Solution

perhaps made simpler.

IMHO NIO2 is as more complicated than NIO like NIO is more complicated than plain IO.

It supports asynchronous IO calls but these are much harder to use effectively than. NIO or plain IO

If you have Inifiniband, NIO2 can give you lower latency and higher throughput. If you have plain Ethernet, I haven't found it to make much difference.

If you want simplicity, use plain IO.

OTHER TIPS

It's an alternative rather than a replacement, using a different programming model. I wouldn't say it is significantly simpler, if at all. If you want simplicity use java.net and threads.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top