incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1202097 - /sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/PersistenceHandler.java
Date Tue, 15 Nov 2011 08:51:56 GMT
Author: cziegeler
Date: Tue Nov 15 08:51:55 2011
New Revision: 1202097

URL: http://svn.apache.org/viewvc?rev=1202097&view=rev
Log:
SLING-2286 : Ignore repository exception for loading of a single job

Modified:
    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/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=1202097&r1=1202096&r2=1202097&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
Tue Nov 15 08:51:55 2011
@@ -612,28 +612,34 @@ public class PersistenceHandler implemen
                 long count = 0;
                 while ( result.hasNext() && count < maxLoad ) {
                     final Node eventNode = result.nextNode();
-                    final String propPath = eventNode.getPath() + '/' + JCRHelper.NODE_PROPERTY_CREATED;
-                    if ( session.itemExists(propPath) ) {
-                        eventCreated = eventNode.getProperty(JCRHelper.NODE_PROPERTY_CREATED).getLong();
-                        if ( tryToLoadJob(eventNode, this.unloadedJobs) ) {
-                            count++;
+                    try {
+                        if ( eventNode.hasProperty(JCRHelper.NODE_PROPERTY_CREATED) ) {
+                            eventCreated = eventNode.getProperty(JCRHelper.NODE_PROPERTY_CREATED).getLong();
+                            if ( tryToLoadJob(eventNode, this.unloadedJobs) ) {
+                                count++;
+                            }
                         }
+                    } catch (final RepositoryException re) {
+                        this.logger.error("Unable to load stored job from " + eventNode,
re);
                     }
                 }
                 // now we have to add all jobs with the same created time!
                 boolean done = false;
                 while ( result.hasNext() && !done ) {
                     final Node eventNode = result.nextNode();
-                    final String propPath = eventNode.getPath() + '/' + JCRHelper.NODE_PROPERTY_CREATED;
-                    if ( session.itemExists(propPath) ) {
-                        final long created = eventNode.getProperty(JCRHelper.NODE_PROPERTY_CREATED).getLong();
-                        if ( created == eventCreated ) {
-                            if ( tryToLoadJob(eventNode, this.unloadedJobs) ) {
-                                count++;
+                    try {
+                        if ( eventNode.hasProperty(JCRHelper.NODE_PROPERTY_CREATED) ) {
+                            final long created = eventNode.getProperty(JCRHelper.NODE_PROPERTY_CREATED).getLong();
+                            if ( created == eventCreated ) {
+                                if ( tryToLoadJob(eventNode, this.unloadedJobs) ) {
+                                    count++;
+                                }
+                            } else {
+                                done = true;
                             }
-                        } else {
-                            done = true;
                         }
+                    } catch (final RepositoryException re) {
+                        this.logger.error("Unable to load stored job from " + eventNode,
re);
                     }
                 }
                 // have we processed all jobs?
@@ -641,7 +647,7 @@ public class PersistenceHandler implemen
                     eventCreated = -1;
                 }
                 logger.debug("Loaded {} jobs and new since {}", count, eventCreated);
-            } catch (RepositoryException re) {
+            } catch (final RepositoryException re) {
                 this.logger.error("Exception during initial loading of stored jobs.", re);
             } finally {
                 if ( session != null ) {



Mime
View raw message