问题
I know Glassfish uses a component called Grizzly but I am unsure of to exactly what role Grizzly performs. I have read that it is a 'front-end' for Glassfish. Is this correct? What exactly does Grizzly do, say when a HTTP request comes in or a response is being send back, does it pass through Grizzly first? And if so, for what reason?
回答1:
Grizzly does all of the heavy NIO lifting on behalf of one or more of the different containers within GlassFish. It's much like the connector functionality of Tomcat. The Connectors do the network operations on behalf of the core web container.
In the case of HTTP, Grizzly is responsible for parsing and serializing HTTP request/responses. It also provides the infrastructure to allow Servlet Async support to function. In the case of EE7, Grizzly also provides the functionality necessary to support non-blocking I/O within Servlets.
回答2:
Right from the project home page:
The Grizzly NIO and Web framework has been designed to help developers to take advantage of the Java™ NIO API. Grizzly's goal is to help developers to build scalable and robust servers using NIO and we are also offering extended framework components: Web Framework (HTTP/S), Bayeux Protocol, Servlet, HttpService OSGi and Comet.
A Users Guide is available along with code examples which demonstrate its various usages.
Please see the Grizzly project on Java.net for more details, and how to participate.
来源:https://stackoverflow.com/questions/14247134/how-does-grizzly-fit-in-with-glassfish