On Wednesday, May 09, 2012 04:41:45 PM Jérôme Revillard wrote: > > 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.
Right. But lockObject is an instance variable. However, there is likely only a single instance of the interceptor. So, let's say you have two requests coming in: Request 1 calls getLockObject() which returns a lock, it locks it (increase to 1) and continues..... Request 2 comes in, calls getLockObject() which this time returns null. Now, on Request1 thread, some exception occurs. In handleFault, lockObject is null, no unlock occurs. That's really why any lock object that a request uses should be stuck on the message/exchange. Avoid instance variable if possible. Dan > 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 ? > Daniel Kulp [email protected] - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com
