You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2015/03/19 17:19:38 UTC

[12/50] incubator-usergrid git commit: Fixes issue with not deleting from the map on message ack

Fixes issue with not deleting from the map on message ack


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

Branch: refs/heads/USERGRID-405
Commit: 8fa5c9f8f4b6580eccba820c5fbbfdf9f088ed87
Parents: 001f3f8
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Mar 11 11:52:20 2015 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Mar 11 11:52:20 2015 -0600

----------------------------------------------------------------------
 .../persistence/index/impl/BufferQueueSQSImpl.java    | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8fa5c9f8/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/BufferQueueSQSImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/BufferQueueSQSImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/BufferQueueSQSImpl.java
index c6acb36..25c2ba6 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/BufferQueueSQSImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/BufferQueueSQSImpl.java
@@ -190,7 +190,7 @@ public class BufferQueueSQSImpl implements BufferQueue {
             //load them into our response
             for ( final QueueMessage message : messages ) {
 
-                final String key = message.getBody().toString();
+                final String key = getMessageKey( message );
 
                 //now see if the key was there
                 final String payload = values.get( key );
@@ -238,6 +238,15 @@ public class BufferQueueSQSImpl implements BufferQueue {
         List<QueueMessage> toAck = new ArrayList<>( messages.size() );
 
         for ( IndexOperationMessage ioe : messages ) {
+
+
+            final SqsIndexOperationMessage sqsIndexOperationMessage =   ( SqsIndexOperationMessage ) ioe;
+
+            final String key = getMessageKey(sqsIndexOperationMessage.getMessage());
+
+            //remove it from the map
+            mapManager.delete( key  );
+
             toAck.add( ( ( SqsIndexOperationMessage ) ioe ).getMessage() );
         }
 
@@ -257,6 +266,9 @@ public class BufferQueueSQSImpl implements BufferQueue {
         return mapper.writeValueAsString( o );
     }
 
+    private String getMessageKey(final QueueMessage message){
+        return message.getBody().toString();
+    }
 
     /**
      * The message that subclasses our IndexOperationMessage.  holds a pointer to the original message