users@jersey.java.net

[Jersey] Re: Factory.dispose is not called

From: Gordan Krešić <gordan.kresic_at_steatoda.com>
Date: Thu, 26 Nov 2015 13:36:57 +0100

Is there any additional information that I can/should provide?

I can reproduce this behaviour in two distinct projects, but if neccessary I
can put together an additional simple test case.

-- 
Gordan Krešić
Steatoda d.o.o.
mailto:gordan.kresic_at_steatoda.com
tel:// +385 1 38 32 456
mob:// +385 91 514 9112
On 20.11.2015 10:53, Gordan Krešić wrote:
> Unfortunately, it seems I found yet another issue regarding this (missing)
> invocation: if user closes its browser window before response is ready to be
> sent, Factory.dispose is not called. No error is reported. Verified in
> Firefox and Chrome.
>
> Simplified case:
>
> 1. Request maps to resources method
>
> 2. All dependant resources gets injected (Factory.provide is called)
>
> 3. Resource method starts its long operation
>
> 4. User closes browser window
>
> 5. Resource method finishes, no error are reported
>
> 6. Factory.dispose for injected resources is NOT called.
>
> Using Jersey 2.22.1, Tomcat 7.0.56 and Java 1.8.0_60-b27.
>
> --
> Gordan Krešić
> Steatoda d.o.o.
> mailto:gordan.kresic_at_steatoda.com
> tel:// +385 1 38 32 456
> mob:// +385 91 514 9112
>
> On 12.06.2015 09:46, Gordan Krešić wrote:
>> Yep, it works now.
>>
>> Tnx.
>>
>> --
>> Gordan Krešić
>> Steatoda d.o.o.
>> mailto:gordan.kresic_at_steatoda.com
>> tel:// +385 1 38 32 456
>> mob:// +385 91 514 9112
>>
>> On 10.06.2015 01:39, Marek Potociar wrote:
>>> I just tested the attached application
>>> <https://github.com/sonyandy/jersey-test> with Jersey 2.18 and it works.
>>> Please try if switching to 2.18 will help.
>>>
>>> Marek
>>>
>>>> On 03 Jun 2015, at 02:39, Gordan Krešić <gordan.kresic_at_steatoda.com
>>>> <mailto:gordan.kresic_at_steatoda.com>> wrote:
>>>>
>>>> Using Jersey 2.17, I'm facing exactly the same situation as described in
>>>> this (resolved, fixed) bug:
>>>>
>>>> https://java.net/jira/browse/JERSEY-2299
>>>>
>>>> No matter what I try, Factory.dispose(...) is not called.
>>>>
>>>> I'm using workaround as described at http://stackoverflow.com/a/20200538
>>>> (@Inject-ing CloseableService and registering my own Closeable), but it
>>>> seems that Factory.dispose should be much cleaner way to do it, if it
>>>> worked
>>>> correctly.
>>>>
>>>> --
>>>> Gordan Krešić
>>>> Steatoda d.o.o.
>>>> mailto:gordan.kresic_at_steatoda.com
>>>> tel:// +385 1 38 32 456
>>>> mob:// +385 91 514 9112
>>>