You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2010/09/10 21:19:23 UTC

svn commit: r995945 - /sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java

Author: cziegeler
Date: Fri Sep 10 19:19:22 2010
New Revision: 995945

URL: http://svn.apache.org/viewvc?rev=995945&view=rev
Log:
SLING-1754 : Jobs nodes should be unlocked after they have been changed

Modified:
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java?rev=995945&r1=995944&r2=995945&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java Fri Sep 10 19:19:22 2010
@@ -1393,18 +1393,11 @@ public class JobEventHandler
                 this.logger.error("Unable to access repository to check job node.", re);
                 errorOccured = false;
             }
+            final String jobId = (String)job.getProperty(EventUtil.PROPERTY_JOB_ID);
             if ( eventNode != null ) {
-                // unlock node
-                try {
-                    this.backgroundSession.getWorkspace().getLockManager().unlock(eventNode.getPath());
-                } catch (RepositoryException e) {
-                    // if unlock fails, we silently ignore this
-                    this.ignoreException(e);
-                }
                 // update status in repository
                 try {
                     if ( !reschedule ) {
-                        final String jobId = (String)job.getProperty(EventUtil.PROPERTY_JOB_ID);
                         if ( jobId == null ) {
                             // remove node from repository if no job id is set
                             eventNode.remove();
@@ -1422,6 +1415,15 @@ public class JobEventHandler
                     // if an exception occurs, we just log
                     this.logger.error("Exception during finished job update.", re);
                 }
+                if ( reschedule || jobId != null ) {
+                    // unlock node
+                    try {
+                        this.backgroundSession.getWorkspace().getLockManager().unlock(eventNode.getPath());
+                    } catch (RepositoryException e) {
+                        // if unlock fails, we silently ignore this
+                        this.ignoreException(e);
+                    }
+                }
             }
         }
         // check for error