incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1141429 - in /sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr: LockManager.java PersistenceHandler.java
Date Thu, 30 Jun 2011 07:25:58 GMT
Author: cziegeler
Date: Thu Jun 30 07:25:58 2011
New Revision: 1141429

URL: http://svn.apache.org/viewvc?rev=1141429&view=rev
Log:
SLING-2118 : Refresh long running sessions if save fails

Modified:
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/LockManager.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/PersistenceHandler.java

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/LockManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/LockManager.java?rev=1141429&r1=1141428&r2=1141429&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/LockManager.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/LockManager.java
Thu Jun 30 07:25:58 2011
@@ -242,6 +242,11 @@ public class LockManager implements Runn
                 logger.debug("Heartbeat at {}", Environment.APPLICATION_ID);
             } catch (final RepositoryException re) {
                 this.ignoreException(re);
+                try {
+                    this.backgroundSession.refresh(false);
+                } catch (final RepositoryException ignore) {
+                    this.ignoreException(ignore);
+                }
             }
         }
     }

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/PersistenceHandler.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/PersistenceHandler.java?rev=1141429&r1=1141428&r2=1141429&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/PersistenceHandler.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/PersistenceHandler.java
Thu Jun 30 07:25:58 2011
@@ -861,7 +861,19 @@ public class PersistenceHandler implemen
         if ( jobId != null ) {
             eventNode.setProperty(JCRHelper.NODE_PROPERTY_JOBID, jobId);
         }
-        rootNode.getSession().save();
+        boolean refresh = true;
+        try {
+            rootNode.getSession().save();
+            refresh = false;
+        } finally {
+            if ( refresh ) {
+                try {
+                    rootNode.getSession().refresh(false);
+                } catch (final RepositoryException ignore) {
+                    this.ignoreException(ignore);
+                }
+            }
+        }
         return eventNode;
     }
 
@@ -1156,9 +1168,14 @@ public class PersistenceHandler implemen
                         this.lockManager.unlock(this.backgroundSession, path);
                     }
                 }
-            } catch (RepositoryException re) {
+            } catch (final RepositoryException re) {
                 // there is nothing we can do
                 this.ignoreException(re);
+                try {
+                    this.backgroundSession.refresh(false);
+                } catch (final RepositoryException ignore) {
+                    this.ignoreException(ignore);
+                }
             }
         }
     }
@@ -1194,6 +1211,11 @@ public class PersistenceHandler implemen
                     }
                 } catch (RepositoryException e) {
                     this.logger.error("Error during cancelling job at " + path, e);
+                    try {
+                        this.backgroundSession.refresh(false);
+                    } catch (final RepositoryException ignore) {
+                        this.ignoreException(ignore);
+                    }
                 }
             }
         }
@@ -1226,6 +1248,11 @@ public class PersistenceHandler implemen
             } catch (RepositoryException re) {
                 // there is nothing we can do
                 this.ignoreException(re);
+                try {
+                    this.backgroundSession.refresh(false);
+                } catch (final RepositoryException ignore) {
+                    this.ignoreException(ignore);
+                }
             }
         }
         ((DefaultJobManager)this.jobManager).notifyRemoveJob(info.uniqueId);



Mime
View raw message