Repository: usergrid Updated Branches: refs/heads/master a31fa45dc -> b89526065
Synchronize creation/connecting of datastax cluster and sessions. Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/b8952606 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/b8952606 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/b8952606 Branch: refs/heads/master Commit: b895260655636b62dd81919d580a4d018e09f369 Parents: a31fa45 Author: Michael Russo <mru...@apigee.com> Authored: Sat Nov 12 00:33:37 2016 -0800 Committer: Michael Russo <mru...@apigee.com> Committed: Sat Nov 12 00:33:37 2016 -0800 ---------------------------------------------------------------------- .../core/datastax/impl/DataStaxClusterImpl.java | 14 +++++++------- .../graph/src/test/resources/usergrid.properties | 3 +++ 2 files changed, 10 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/b8952606/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/datastax/impl/DataStaxClusterImpl.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/datastax/impl/DataStaxClusterImpl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/datastax/impl/DataStaxClusterImpl.java index 55a2de8..7783a0c 100644 --- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/datastax/impl/DataStaxClusterImpl.java +++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/datastax/impl/DataStaxClusterImpl.java @@ -58,7 +58,7 @@ public class DataStaxClusterImpl implements DataStaxCluster { } @Override - public Cluster getCluster(){ + public synchronized Cluster getCluster(){ // ensure we can build the cluster if it was previously closed if ( cluster.isClosed() ){ @@ -69,7 +69,7 @@ public class DataStaxClusterImpl implements DataStaxCluster { } @Override - public Session getClusterSession(){ + public synchronized Session getClusterSession(){ // always grab cluster from getCluster() in case it was prematurely closed if ( clusterSession == null || clusterSession.isClosed() ){ @@ -80,7 +80,7 @@ public class DataStaxClusterImpl implements DataStaxCluster { } @Override - public Session getApplicationSession(){ + public synchronized Session getApplicationSession(){ // always grab cluster from getCluster() in case it was prematurely closed if ( applicationSession == null || applicationSession.isClosed() ){ @@ -91,7 +91,7 @@ public class DataStaxClusterImpl implements DataStaxCluster { @Override - public Session getApplicationLocalSession(){ + public synchronized Session getApplicationLocalSession(){ // always grab cluster from getCluster() in case it was prematurely closed if ( queueMessageSession == null || queueMessageSession.isClosed() ){ @@ -106,7 +106,7 @@ public class DataStaxClusterImpl implements DataStaxCluster { * @throws Exception */ @Override - public void createApplicationKeyspace() throws Exception { + public synchronized void createApplicationKeyspace() throws Exception { boolean exists = getClusterSession().getCluster().getMetadata() .getKeyspace(CQLUtils.quote( cassandraConfig.getApplicationKeyspace())) != null; @@ -135,7 +135,7 @@ public class DataStaxClusterImpl implements DataStaxCluster { * @throws Exception */ @Override - public void createApplicationLocalKeyspace() throws Exception { + public synchronized void createApplicationLocalKeyspace() throws Exception { boolean exists = getClusterSession().getCluster().getMetadata() .getKeyspace(CQLUtils.quote( cassandraConfig.getApplicationLocalKeyspace())) != null; @@ -180,7 +180,7 @@ public class DataStaxClusterImpl implements DataStaxCluster { } } - public Cluster buildCluster(){ + public synchronized Cluster buildCluster(){ ConsistencyLevel defaultConsistencyLevel; try { http://git-wip-us.apache.org/repos/asf/usergrid/blob/b8952606/stack/corepersistence/graph/src/test/resources/usergrid.properties ---------------------------------------------------------------------- diff --git a/stack/corepersistence/graph/src/test/resources/usergrid.properties b/stack/corepersistence/graph/src/test/resources/usergrid.properties index 015c681..d67258d 100644 --- a/stack/corepersistence/graph/src/test/resources/usergrid.properties +++ b/stack/corepersistence/graph/src/test/resources/usergrid.properties @@ -1,2 +1,5 @@ # This property is required to be set and cannot be defaulted anywhere usergrid.cluster_name=usergrid + +cassandra.connections=30 +cassandra.timeout.pool=20000