users@grizzly.java.net

Re: [Jersey] Refactoring the container SPI

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Thu, 12 Jun 2008 13:05:16 -0400

Salut,

Paul Sandoz wrote:
> Jeanfrancois Arcand wrote:
>> Hum...the GrizzlyAdapter has the following code:
>>
>>> GrizzlyRequest request = (GrizzlyRequest)
>>> req.getNote(ADAPTER_NOTES);
>>> GrizzlyResponse response = (GrizzlyResponse)
>>> res.getNote(ADAPTER_NOTES);
>>>
>>> if (request == null || response == null) {
>>> return;
>>> }
>>> try {
>>> response.finishResponse();
>>> req.action(ActionCode.ACTION_POST_REQUEST, null);
>>> res.finish();
>>> } catch (Throwable t) {
>>> getLogger().log(Level.SEVERE,"afterService exception",t);
>>> } finally {
>>> // Recycle the wrapper request and response
>>> request.recycle();
>>> response.recycle();
>>> req.recycle();
>>> res.recycle();
>>> }
>>> try{
>>> afterService(request,response);
>>> } catch (Exception ex){
>>> logger.log(Level.SEVERE,"afterService", ex);
>>> throw ex;
>>> }
>>
>> Which close the connection. Which test case should I look at to
>> reproduce and debug the issue?
>>
>
> There is no issue. All the Jersey-Grizzly unit tests pass. I think i am
> mistaken: i thought that it was the responsibility of the
> GrizzlyContainer to close the output stream of the response.

ah sorry my bad translation :-) By default, when you are using
GrizzlyAdapter, this class take care of committing the response. Before
Jersey was using its own Adapter implementation, and that one was
explicitly committing the connection (using the code above). That's why
I came with GrizzlyAdapter, which reduce the number of operation an
Adapter needs to do (and simple to use).

I've filled issue:

https://grizzly.dev.java.net/issues/show_bug.cgi?id=160

and changed the afterService from being abstract to public. Good catch!

A+

-- Jeanfrancois


>
> Paul.
>