[infinispan-dev] lock acquisition - "finally release" it

Philippe Van Dyck pvdyck at gmail.com
Sun May 16 13:35:15 EDT 2010


Hi all,

in a servlet environment, you sometimes have to claim back a thread for your
thread pool.
Jetty has a nice "denial of service attack" filter and a setting
(maxIdleTime) interrupting servlet threads if nothing comes out (nothing is
written in the pipe).

Well it does not play well with infinispan. Everybody knows that when you
open a stream, the best way to reclaim scarce resources is to close it in a
'finally' statement. What about applying it to infinispan locking mechanism
? ;-)

Calls to acquireLock should be guarded by a finally {releaseLock} (at least
to catch an interruptedException)

It looks very easy to implement, but since releaseLock does not seems to be
called every time in the code, I need help !

The only places where aquireLock is called are
CacheLoaderInterceptor.loadIfNeeded and
EntryFactoryImpl.wrapEntryForWriting.

And BTW, the locks never expire ... so if you interrupt a thread and the
lock is not released, you better say bye bye to the cache entry!

Cheers,

Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/infinispan-dev/attachments/20100516/87b0c66f/attachment.html 


More information about the infinispan-dev mailing list