Adding distinctive logging, also: no longer wrap RuntimeException in 
RuntimeException


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/6b195a07
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/6b195a07
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/6b195a07

Branch: refs/heads/usergrid-1268-akka-211
Commit: 6b195a07b94858deecdc80156d9ab9ebd6ae4a80
Parents: 223521e
Author: Dave Johnson <snoopd...@apache.org>
Authored: Thu May 5 15:48:35 2016 -0400
Committer: Dave Johnson <snoopd...@apache.org>
Committed: Thu May 5 15:48:35 2016 -0400

----------------------------------------------------------------------
 .../org/apache/usergrid/services/ServiceManager.java   | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/6b195a07/stack/services/src/main/java/org/apache/usergrid/services/ServiceManager.java
----------------------------------------------------------------------
diff --git 
a/stack/services/src/main/java/org/apache/usergrid/services/ServiceManager.java 
b/stack/services/src/main/java/org/apache/usergrid/services/ServiceManager.java
index 1ed73d6..ef1baaf 100644
--- 
a/stack/services/src/main/java/org/apache/usergrid/services/ServiceManager.java
+++ 
b/stack/services/src/main/java/org/apache/usergrid/services/ServiceManager.java
@@ -128,18 +128,27 @@ public class ServiceManager {
                     if ( application != null ) {
                         appNotFound = false;
                         applicationId = application.getUuid();
+
                     } else {
+                        // Cassandra may be alive but responding very slowly, 
let's wait and retry
+                        logger.error("STARTUP PROBLEM: Cannot get application 
by UUID. Will retry in {} seconds #{}",
+                            retryInterval/1000, retryCount);
                         Thread.sleep( retryInterval );
                         retryCount++;
                     }
                 }
 
                 if ( application == null ) {
-                    Exception e = new RuntimeException( "application id {" + 
em.getApplicationId() + "} is returning null" );
-                    logger.error( "Failed to get application", e );
+                    Exception e = new RuntimeException(
+                        "STARTUP FAILURE: application id {" + 
em.getApplicationId()
+                            + "} is returning null after " + retryCount + " 
retries" );
                     throw e;
                 }
 
+            } catch ( RuntimeException re ) {
+                logger.error( "ServiceManager init failure", re );
+                throw re;
+
             } catch ( Exception e ) {
                 logger.error( "ServiceManager init failure", e );
                 throw new RuntimeException( e );

Reply via email to