incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r767390 - /incubator/sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java
Date Wed, 22 Apr 2009 06:24:21 GMT
Author: fmeschbe
Date: Wed Apr 22 06:24:20 2009
New Revision: 767390

URL: http://svn.apache.org/viewvc?rev=767390&view=rev
Log:
SLING-935 Dipose off repository if pingAndCheck fails after pingRepository and add more logging
SLING-934 Clear instance field in unbindLog instead of parameter

Modified:
    incubator/sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java

Modified: incubator/sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java?rev=767390&r1=767389&r2=767390&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java
(original)
+++ incubator/sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java
Wed Apr 22 06:24:20 2009
@@ -626,8 +626,12 @@
         // immediately try to start the repository while activating
         // this component instance
         try {
-            startRepository();
-            log(LogService.LOG_INFO, "Repository started successfully"); 
+            if (startRepository()) {
+                log(LogService.LOG_INFO, "Repository started successfully");
+            } else {
+                log(LogService.LOG_WARNING,
+                    "Repository startup failed, will try later");
+            }
         } catch (Throwable t) {
             log(LogService.LOG_WARNING,
                 "activate: Unexpected problem starting repository", t);
@@ -671,7 +675,7 @@
 
     protected void unbindLog(LogService log) {
         if (this.log == log) {
-            log = null;
+            this.log = null;
         }
     }
 
@@ -807,12 +811,7 @@
                 if (pingRepository(newRepo)) {
                     repository = newRepo;
 
-                    if(!pingAndCheck()) {
-                        repository = null;
-                        log(LogService.LOG_DEBUG, "pingRepository() successful but pingAndCheck()
fails, will try again");
-                        return false;
-
-                    } else {
+                    if(pingAndCheck()) {
                         log(LogService.LOG_DEBUG,
                             "startRepository: pingRepository() and pingAndCheck() successful,
calling setupRepository()");
                         setupRepository(newRepo);
@@ -827,12 +826,27 @@
 
                         return true;
                     }
+
+                    // ping succeeded but pingAndCheck fail, we have to drop
+                    // the repository in this situation and restart from
+                    // scratch later
+                    log(
+                        LogService.LOG_DEBUG,
+                        "pingRepository() successful but pingAndCheck() fails, calling disposeRepository()");
+                    
+                    // drop reference
+                    repository = null;
+                    
+                } else {
+
+                    // otherwise let go of the repository and fail startup
+                    log(LogService.LOG_DEBUG,
+                        "startRepository: pingRepository() failed, calling disposeRepository()");
+
                 }
 
-                // otherwise let go of the repository and fail startup
-                log(LogService.LOG_DEBUG,
-                    "startRepository: pingRepository() failed, calling disposeRepository()");
-                disposeRepository(repository);
+                // ping or pingAndCheck failed: dispose off repository
+                disposeRepository(newRepo);
             }
         } catch (Throwable t) {
             // consider an uncaught problem an error



Mime
View raw message