What's the code for the getLockObject()? Is the lock something that is
per endpoint or something created per request/session/etc?
If it's not a "gobal" type lock that needs a per instance/perrequest scope,
you shouldn't use the instance variable like that. You can store the lock
on the message (or exchange) via something like:
message.getExchange().put("MyLock", lock);
and retrieve it in the out interceptor and in handleFault via
Lock l = message.getExchange().get("MyLock");
My next question is are you sure the unlock method is not being called as
apposed to being called too often? Looking at your code, I could see the
later. The "throw new ..." calls in the handle method may occur
without a lock being obtained, but then the handleFault would be called and
the unlock called. Thus, unlock with no corresponding lock. Saving the
Lock on the message/exchange like above could help as you could only save it
there if you DO obtain the lock.
Dan
On Wednesday, May 09, 2012 12:23:28 AM Jerome Revillard wrote:
> Dear all,
>
> For our product, we created 2 specific interceptors (1 in and one out).
> The goal of those 2 interceptors is to "lock" some objects which will be
> used during the web service operation.
>
> The InInterceptor is like this:
>
>
>
>
> The OutInterceptor is like that:
>
>
>
> As we consider that more than 1 operation can be handle in the same time
> for the same 'lockObject', the lock() and unlock() operation increase or
> decrease an integer:
>
>
>
> The problem that we are facing here is that, some time (we did not manage
> to catch it), the unlock() operation is not called and the system stay
> locked.
>
> Can somebody please tell me where the mistake is ? The goal is to be 100%
> sure that the unlock operation will be call exactly 1 time (not 0 nor
> more) if the lock operation has been called in the input interceptor.
>
> Thanks for your help.
> Best,
> Jérôme
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Interceptors-behaviour-tp5696667.html
> Sent from the cxf-user mailing list archive at Nabble.com.
--
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com