usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mru...@apache.org
Subject [1/2] usergrid git commit: Update /status call to check cassandra system table with CL_ONE and expose property for queue polling timeshift from the socket timeout.
Date Tue, 01 Mar 2016 22:55:16 GMT
Repository: usergrid
Updated Branches:
  refs/heads/master 16c270774 -> fafaa4e74


Update /status call to check cassandra system table with CL_ONE and expose property for queue
polling timeshift from the socket timeout.


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

Branch: refs/heads/master
Commit: 5dee6c8d4b155dbaa4295f43e4433993faa7ccfa
Parents: bcc9780
Author: Michael Russo <mrusso@apigee.com>
Authored: Tue Mar 1 14:54:46 2016 -0800
Committer: Michael Russo <mrusso@apigee.com>
Committed: Tue Mar 1 14:54:46 2016 -0800

----------------------------------------------------------------------
 .../collection/impl/EntityCollectionManagerImpl.java      |  8 ++++++--
 .../org/apache/usergrid/persistence/queue/QueueFig.java   |  3 +++
 .../persistence/queue/impl/SNSQueueManagerImpl.java       | 10 +++++++---
 .../shiro/credentials/ApplicationAccessToken.java         |  2 +-
 .../shiro/credentials/OrganizationAccessToken.java        |  2 +-
 5 files changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/5dee6c8d/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
index ce30568..06025d3 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
@@ -26,6 +26,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.UUID;
 
+import com.netflix.astyanax.model.ConsistencyLevel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -446,9 +447,12 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
                     StringSerializer.get() );
 
             OperationResult<CqlResult<String, String>> result =
-                keyspace.prepareQuery( CF_SYSTEM_LOCAL ).withCql( "SELECT now() FROM system.local;"
).execute();
+                keyspace.prepareQuery( CF_SYSTEM_LOCAL )
+                    .setConsistencyLevel(ConsistencyLevel.CL_ONE)
+                    .withCql( "SELECT now() FROM system.local;" )
+                    .execute();
 
-            if ( result.getResult().getRows().size() == 1 ) {
+            if ( result.getResult().getRows().size() > 0 ) {
                 return Health.GREEN;
             }
         }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5dee6c8d/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueFig.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueFig.java
b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueFig.java
index 63d2d80..383ab80 100644
--- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueFig.java
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueFig.java
@@ -95,5 +95,8 @@ public interface QueueFig extends GuicyFig {
     @Default( "10000" ) // 10 seconds
     int getQueueClientSocketTimeout();
 
+    @Key( "usergrid.queue.poll.timeshift")
+    @Default( "3000" ) // 3 seconds
+    int getQueuePollTimeshift();
 
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5dee6c8d/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SNSQueueManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SNSQueueManagerImpl.java
b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SNSQueueManagerImpl.java
index 4dd9bda..6c78035 100644
--- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SNSQueueManagerImpl.java
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SNSQueueManagerImpl.java
@@ -97,6 +97,8 @@ public class SNSQueueManagerImpl implements QueueManager {
 
     private static final JsonFactory JSON_FACTORY = new JsonFactory();
     private static final ObjectMapper mapper = new ObjectMapper( JSON_FACTORY );
+    private static final int MIN_CLIENT_SOCKET_TIMEOUT = 5000; // millis
+    private static final int MIN_VISIBILITY_TIMEOUT = 1; //seconds
 
     static {
 
@@ -170,7 +172,7 @@ public class SNSQueueManagerImpl implements QueueManager {
         this.clientConfiguration = new ClientConfiguration()
             .withConnectionTimeout(queueFig.getQueueClientConnectionTimeout())
             // don't let the socket timeout be configured less than 5 sec (network delays
do happen)
-            .withSocketTimeout(Math.max(5000, queueFig.getQueueClientSocketTimeout()))
+            .withSocketTimeout(Math.max(MIN_CLIENT_SOCKET_TIMEOUT, queueFig.getQueueClientSocketTimeout()))
             .withGzip(true);
 
         try {
@@ -427,10 +429,12 @@ public class SNSQueueManagerImpl implements QueueManager {
 
         ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest( url );
         receiveMessageRequest.setMaxNumberOfMessages( limit );
-        receiveMessageRequest.setVisibilityTimeout( Math.max( 1, fig.getVisibilityTimeout()
/ 1000 ) );
+        receiveMessageRequest.setVisibilityTimeout(
+            Math.max( MIN_VISIBILITY_TIMEOUT, fig.getVisibilityTimeout() / 1000 ) );
 
         // set SQS long polling to 3 secs < the client socket timeout (network delays)
with min of 0 (no long poll)
-        receiveMessageRequest.setWaitTimeSeconds( Math.max(0, ( fig.getQueueClientSocketTimeout()
- 3000) / 1000 ) );
+        receiveMessageRequest.setWaitTimeSeconds(
+            Math.max(0, ( fig.getQueueClientSocketTimeout() - fig.getQueuePollTimeshift()
) / 1000 ) );
 
         try {
             ReceiveMessageResult result = sqs.receiveMessage( receiveMessageRequest );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5dee6c8d/stack/services/src/main/java/org/apache/usergrid/security/shiro/credentials/ApplicationAccessToken.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/security/shiro/credentials/ApplicationAccessToken.java
b/stack/services/src/main/java/org/apache/usergrid/security/shiro/credentials/ApplicationAccessToken.java
index 91d95d2..2a69523 100644
--- a/stack/services/src/main/java/org/apache/usergrid/security/shiro/credentials/ApplicationAccessToken.java
+++ b/stack/services/src/main/java/org/apache/usergrid/security/shiro/credentials/ApplicationAccessToken.java
@@ -20,7 +20,7 @@ package org.apache.usergrid.security.shiro.credentials;
 public class ApplicationAccessToken extends AbstractAccessTokenCredentials implements ApplicationCredentials
{
 
     // Do not remove, needed for Jackson to handle deserialization
-    public ApplicationAccessToken(){}
+    protected ApplicationAccessToken(){}
 
     public ApplicationAccessToken( String token ) {
         super( token );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5dee6c8d/stack/services/src/main/java/org/apache/usergrid/security/shiro/credentials/OrganizationAccessToken.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/security/shiro/credentials/OrganizationAccessToken.java
b/stack/services/src/main/java/org/apache/usergrid/security/shiro/credentials/OrganizationAccessToken.java
index 36e78c6..c2cc430 100644
--- a/stack/services/src/main/java/org/apache/usergrid/security/shiro/credentials/OrganizationAccessToken.java
+++ b/stack/services/src/main/java/org/apache/usergrid/security/shiro/credentials/OrganizationAccessToken.java
@@ -20,7 +20,7 @@ package org.apache.usergrid.security.shiro.credentials;
 public class OrganizationAccessToken extends AbstractAccessTokenCredentials implements OrganizationCredentials
{
 
     // Do not remove, needed for Jackson to handle deserialization
-    public OrganizationAccessToken(){}
+    protected OrganizationAccessToken(){}
 
     public OrganizationAccessToken( String token ) {
         super( token );


Mime
View raw message