Does anyone know of any node.js style webserver framework for java? I realized that having nonblocking callback behavior while handling a web request will require deep support at the webserver level. I am interested in node.js, but when I have a web server that ends up persisting data, I would like to take advantage of the static type system that Java offers. However, I want the scalability of non-blocking io.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Maybe you don't want it at all. There's a lot of evidence emerging that 'scalable NIO' doesn't really deliver its benefits until an enormous number of clients. Remember that select() and friend were designed back when the unit of computation was a process, not a thread. Unless you are plannig on having hundreds of thousands of ocnnections from day one, I would definitely build in java.net first and then evaluate.
Deft
Features
Grizzly may be what you're looking for.
Further, if you're interested in using the Servlet API, which also offers asynchronous support since 3.0, then it may be good to know that decent servletcontainers supports NIO as well (often by just utilizing Grizzly under the covers) like Apache Tomcat 7 and Oracle Glassfish 3.
I asked myself the same question, and instead of searching around like I should have, I looked at how you might write a framework for deploying software components to a nio server, similar to the way you might deploy servlets and ejbs to a Java EE container. I've blogged it at http://blog.maxant.co.uk/pebble/2011/05/22/1306092969466.html, in case that helps you.
My take on this is Play! Framework (See http://www.playframework.com/). It supports development in Java and Scala. Play is built on top of Netty (See http://netty.io/) which itself is a NIO (Non-blocking IO) client-server framework. Play (and Netty) use Futures (result of an asynchronous operation/a read handle to something that may happen at some point of time in future) and Promises(a writable Future) to solve this problem (See http://en.wikipedia.org/wiki/Futures_and_promises)
Currently two major frameworks you can use