jakarta-jcs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Archer <scott.arc...@gmail.com>
Subject JCSWorker locks indefinitely - code fix provided.
Date Fri, 04 Dec 2009 15:20:20 GMT
Is there any chance we could get this code into the trunk?
We're running off our own build now, and it would be nice to keep in sync
with any changes going forward.

We've implemented this code change and the fix is working great.




When using the JCSWorker threads lock indefinitely.
I believe the synchronized block in the finally block is synchronizing on
and notifying the wrong object.

Once a thread locks it never unlocks.

Class: org.apache.jcs.utils.access.JCSWorker
Method: private Object run( Serializable aKey, String aGroup,
JCSWorkerHelper aHelper ) throws Exception

Bad Code (in finally block):
 synchronized ( this )
     aHelper.setFinished( true );
     // Wake everyone waiting on us

Suggested Fix:
 synchronized ( aHelper )
     aHelper.setFinished( true );
     // Wake everyone waiting on aHelper

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message