incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r577732 - /incubator/sling/trunk/content/src/main/java/org/apache/sling/content/jcr/internal/loader/Loader.java
Date Thu, 20 Sep 2007 13:08:51 GMT
Author: cziegeler
Date: Thu Sep 20 06:08:50 2007
New Revision: 577732

URL: http://svn.apache.org/viewvc?rev=577732&view=rev
Log:
Reduce log output. If content loading fails, log this only once - but log success of a retry.

Modified:
    incubator/sling/trunk/content/src/main/java/org/apache/sling/content/jcr/internal/loader/Loader.java

Modified: incubator/sling/trunk/content/src/main/java/org/apache/sling/content/jcr/internal/loader/Loader.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/content/src/main/java/org/apache/sling/content/jcr/internal/loader/Loader.java?rev=577732&r1=577731&r2=577732&view=diff
==============================================================================
--- incubator/sling/trunk/content/src/main/java/org/apache/sling/content/jcr/internal/loader/Loader.java
(original)
+++ incubator/sling/trunk/content/src/main/java/org/apache/sling/content/jcr/internal/loader/Loader.java
Thu Sep 20 06:08:50 2007
@@ -86,13 +86,13 @@
     }
 
     public void registerBundle(Bundle bundle) {
-        if (this.registerBundleInternal(bundle)) {
+        if (this.registerBundleInternal(bundle, false)) {
             // handle delayed bundles, might help now
             int currentSize = -1;
             for (int i=this.delayedBundles.size(); i > 0 && currentSize != this.delayedBundles.size()
&& !this.delayedBundles.isEmpty(); i--) {
                 for (Iterator<Bundle> di=this.delayedBundles.iterator(); di.hasNext();
) {
                     Bundle delayed = di.next();
-                    if (this.registerBundleInternal(delayed)) {
+                    if (this.registerBundleInternal(delayed, true)) {
                         di.remove();
                     }
                 }
@@ -104,20 +104,32 @@
         }
     }
 
-    private boolean registerBundleInternal (Bundle bundle) {
+    private boolean registerBundleInternal (Bundle bundle, boolean isRetry) {
         try {
             this.installContent(bundle);
+            if ( isRetry ) {
+                // log success of retry
+                log.info("Retrytring to load initial content for bundle {} succeeded.",
+                        bundle.getSymbolicName());
+            }
             return true;
         } catch (RepositoryException re) {
-            log.error("Cannot load initial content for bundle {}: {}",
-                bundle.getSymbolicName(), re);
+            // if we are retrying we already logged this message once, so we won't log it
again
+            if ( !isRetry ) {
+                log.error("Cannot load initial content for bundle {}: {}",
+                    bundle.getSymbolicName(), re);
+            }
         }
 
         return false;
     }
 
     public void unregisterBundle(Bundle bundle) {
-        this.uninstallContent(bundle);
+        if ( this.delayedBundles.contains(bundle) ) {
+            this.delayedBundles.remove(bundle);
+        } else {
+            this.uninstallContent(bundle);
+        }
     }
 
     //---------- internal -----------------------------------------------------



Mime
View raw message