Hi Dan, Le 09/05/2012 16:21, Daniel Kulp a écrit : > What's the code for the getLockObject()? Is the lock something that is > per endpoint or something created per request/session/etc?
I just respond to Freeman, The lock is global, shared between many web
services. The getLockObject is not a good name here, it should be,
getLockableObject() in fact
>
> 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");
What is the main difference between what I did and your solution ? If
the problem is that the OutPutInterceptor is not called ?
>
>
> 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.
Ok, in fact, the "if ( xxxxx )" is mainly "if (lockObject != null)" so,
on this case, the handleFault() method will do nothing.
To be a bit more precise, the problem is that, at some point, I get log
messages that says that the lock value is 1, 2, 3 etc... even if there
is no more interaction with the web service. This means that "unlock()"
in one use case is not called... and I cannot identified this use case.
What if the Web Service raise an error what is the Output Chain ?
Best,
Jerome
>
>
> 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.
smime.p7s
Description: Signature cryptographique S/MIME
