You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by rf...@apache.org on 2007/08/31 16:13:28 UTC

svn commit: r571475 - /lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java

Author: rfrovarp
Date: Fri Aug 31 07:13:27 2007
New Revision: 571475

URL: http://svn.apache.org/viewvc?rev=571475&view=rev
Log:
Synchronize access to committed.

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java?rev=571475&r1=571474&r2=571475&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java Fri Aug 31 07:13:27 2007
@@ -130,7 +130,7 @@
      * @throws ConcurrentModificationException if a transactionable has been modified by another
      *         session.
      */
-    public void commit() throws RepositoryException, ConcurrentModificationException {
+    public synchronized void commit() throws RepositoryException, ConcurrentModificationException {
 
         savePersistables();
         



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org


Re: svn commit: r571475 - /lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java

Posted by Richard Frovarp <Ri...@sendit.nodak.edu>.
Andreas Hartmann wrote:
> Hi Richard,
>
> rfrovarp@apache.org schrieb:
>   
>> Author: rfrovarp
>> Date: Fri Aug 31 07:13:27 2007
>> New Revision: 571475
>>
>> URL: http://svn.apache.org/viewvc?rev=571475&view=rev
>> Log:
>> Synchronize access to committed.
>>     
>
> did you find an indication that the commit() method of a single
> SessionImpl object is invoked by more than one thread? Actually this
> should never be the case. The critical part further down the method is
> synchronized via the global transaction lock, which should prevent any
> concurrency issues during the committing of sessions.
>
> -- Andreas
>
>
>   

No, I have not found any indication as such. However, in r564653 you 
added the committed variable (among other things). It is checked in a 
synchronized method down in enqueueEvent. Which was made synchronized 
only when you added the committed variable. It would stand to reason if 
that function is synchronized because of that variable, the function 
modifying it should be synchronized on the same monitor as well. I could 
be wrong, but that is how the bug was found, and my reasoning for the 
change.

Richard

>> Modified:
>>     lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java
>>
>> Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java
>> URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java?rev=571475&r1=571474&r2=571475&view=diff
>> ==============================================================================
>> --- lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java (original)
>> +++ lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java Fri Aug 31 07:13:27 2007
>> @@ -130,7 +130,7 @@
>>       * @throws ConcurrentModificationException if a transactionable has been modified by another
>>       *         session.
>>       */
>> -    public void commit() throws RepositoryException, ConcurrentModificationException {
>> +    public synchronized void commit() throws RepositoryException, ConcurrentModificationException {
>>  
>>          savePersistables();
>>     
>
>
>
>
>   


-- 
Richard Frovarp
EduTech System Administrator
1-701-231-5127 or 
1-800-774-1091


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: svn commit: r571475 - /lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java

Posted by Andreas Hartmann <an...@apache.org>.
Hi Richard,

rfrovarp@apache.org schrieb:
> Author: rfrovarp
> Date: Fri Aug 31 07:13:27 2007
> New Revision: 571475
> 
> URL: http://svn.apache.org/viewvc?rev=571475&view=rev
> Log:
> Synchronize access to committed.

did you find an indication that the commit() method of a single
SessionImpl object is invoked by more than one thread? Actually this
should never be the case. The critical part further down the method is
synchronized via the global transaction lock, which should prevent any
concurrency issues during the committing of sessions.

-- Andreas


> 
> Modified:
>     lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java
> 
> Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java
> URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java?rev=571475&r1=571474&r2=571475&view=diff
> ==============================================================================
> --- lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java (original)
> +++ lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java Fri Aug 31 07:13:27 2007
> @@ -130,7 +130,7 @@
>       * @throws ConcurrentModificationException if a transactionable has been modified by another
>       *         session.
>       */
> -    public void commit() throws RepositoryException, ConcurrentModificationException {
> +    public synchronized void commit() throws RepositoryException, ConcurrentModificationException {
>  
>          savePersistables();




-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org