6

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?

sonicboom
  • 4,928
  • 10
  • 42
  • 60

2 Answers2

13

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.

rlubke
  • 965
  • 5
  • 14
3

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.

John Yeary
  • 1,112
  • 22
  • 45
  • I had already read that. It doesn't tell me how it works with Glassfish. And code examples like these - http://grizzly.java.net/nonav/docs/docbkx2.2/html/coreframework-samples.html - do not answer my question either. – sonicboom Jan 10 '13 at 00:34
  • 2
    Grizzly is an NIO framework that uses handlers for various IO in GlassFish. It offers handlers for requests and responses. Those requests can be HTTP requests, Websockets, etc. The examples show how you can use it as a standalone Web Container for example, or even how to use it to handle JAX-WS. It is similar to Apache Mina that offers the same type of functionality. – John Yeary Jan 10 '13 at 13:24