You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Thomas Vandahl (Resolved) (JIRA)" <ji...@apache.org> on 2011/10/30 19:18:32 UTC

[jira] [Resolved] (JCS-69) Synchronization Problem in JCSWorker

     [ https://issues.apache.org/jira/browse/JCS-69?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Vandahl resolved JCS-69.
-------------------------------

       Resolution: Fixed
    Fix Version/s: jcs-1.4-dev

Mark as fixed as has been suggested.
                
> Synchronization Problem in JCSWorker
> ------------------------------------
>
>                 Key: JCS-69
>                 URL: https://issues.apache.org/jira/browse/JCS-69
>             Project: JCS
>          Issue Type: Bug
>    Affects Versions: jcs-1.3, jcs-1.4-dev
>         Environment: Linux 2.6.28-15-generic #52-Ubuntu SMP Wed Sep 9 10:48:52 UTC 2009 x86_64 GNU/Linux
> java version "1.6.0_16"
> Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
> Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode)
>            Reporter: Scott Archer
>            Assignee: Aaron Smuts
>             Fix For: jcs-1.4-dev
>
>         Attachments: JCSTest.java, cache.ccf
>
>
> 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
>      notifyAll();
>  }
> Suggested Fix:
>  synchronized ( aHelper )
>  {
>      aHelper.setFinished( true );
>      // Wake everyone waiting on aHelper
>      aHelper.notifyAll();
>  }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira