Remove unneeded properties, log when mgmt app lookup fails, minor refactoring
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/4b8e5460 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/4b8e5460 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/4b8e5460 Branch: refs/heads/master Commit: 4b8e5460cb93fb65ee54282e93887668bf7d6f8a Parents: 59c538a Author: Dave Johnson <[email protected]> Authored: Fri Jun 3 07:31:46 2016 -0400 Committer: Dave Johnson <[email protected]> Committed: Fri Jun 3 07:31:46 2016 -0400 ---------------------------------------------------------------------- .../src/main/resources/usergrid-default.properties | 7 ------- .../corepersistence/CpEntityManagerFactory.java | 14 +++++++------- .../exception/CollectionRuntimeException.java | 2 +- 3 files changed, 8 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/4b8e5460/stack/config/src/main/resources/usergrid-default.properties ---------------------------------------------------------------------- diff --git a/stack/config/src/main/resources/usergrid-default.properties b/stack/config/src/main/resources/usergrid-default.properties index 1e22d6a..0fc31ef 100644 --- a/stack/config/src/main/resources/usergrid-default.properties +++ b/stack/config/src/main/resources/usergrid-default.properties @@ -195,13 +195,6 @@ cassandra.lock.writecl=LOCAL_QUORUM # #cassandra.useSocketKeepalive=false -# Number of times to retry creation of lock keyspace and column family -cassandra.lock.init.retries = 100; - -# Interval between lock keyspace creation attempts (in milliseconds) -cassandra.lock.init.interval = 1000; - - ##################### Async Threadpool Settings ##################### # Set the number of threads available in the Rx Async Thread Pool http://git-wip-us.apache.org/repos/asf/usergrid/blob/4b8e5460/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java ---------------------------------------------------------------------- diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java index 622944b..18df205 100644 --- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java +++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java @@ -69,7 +69,6 @@ import java.util.*; import static java.lang.String.CASE_INSENSITIVE_ORDER; import static org.apache.usergrid.persistence.Schema.PROPERTY_NAME; import static org.apache.usergrid.persistence.Schema.TYPE_APPLICATION; -import static org.apache.usergrid.persistence.Schema.initLock; /** @@ -178,26 +177,27 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application } else if ( managementAppEntityManager != null ) { // failed to fetch management app, use cached one entityManager = managementAppEntityManager; + logger.error("Failed to fetch management app"); } } // missing keyspace means we have not done bootstrap yet - final boolean missingKeyspace; + final boolean isBootstrapping; if ( throwable instanceof CollectionRuntimeException ) { CollectionRuntimeException cre = (CollectionRuntimeException) throwable; - missingKeyspace = cre.isMissingKeyspace(); + isBootstrapping = cre.isBootstrapping(); } else { - missingKeyspace = false; + isBootstrapping = false; } // work around for https://issues.apache.org/jira/browse/USERGRID-1291 - // throw exception so that we do not cache + // throw exception so that we do not cache // TODO: determine how application name can intermittently be null if ( app != null && app.getName() == null ) { throw new RuntimeException( "Name is null for application " + appId, throwable ); } - if ( app == null && !missingKeyspace ) { + if ( app == null && !isBootstrapping ) { throw new RuntimeException( "Error getting application " + appId, throwable ); } // else keyspace is missing because setup/bootstrap not done yet @@ -241,7 +241,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application if ( t instanceof CollectionRuntimeException ) { CollectionRuntimeException cre = (CollectionRuntimeException)t; - if ( cre.isMissingKeyspace() ) { + if ( cre.isBootstrapping() ) { // we're bootstrapping, ignore this and continue bootstrapping = true; break; http://git-wip-us.apache.org/repos/asf/usergrid/blob/4b8e5460/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/CollectionRuntimeException.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/CollectionRuntimeException.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/CollectionRuntimeException.java index f27e2d7..8aa2a7a 100644 --- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/CollectionRuntimeException.java +++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/CollectionRuntimeException.java @@ -57,7 +57,7 @@ public class CollectionRuntimeException extends RuntimeException { this.applicationScope = scope; } - public boolean isMissingKeyspace() { + public boolean isBootstrapping() { if ( getCause() instanceof BadRequestException ) { BadRequestException bre = (BadRequestException)getCause(); String msg = bre.getMessage();
