You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by mr...@apache.org on 2015/11/12 20:44:04 UTC

[3/5] usergrid git commit: fix alias issues

fix alias issues


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

Branch: refs/heads/2.1-release
Commit: c068ab0d471bf8bf86dff2a9d3d30ae1baa0f24d
Parents: 3005331
Author: Shawn Feldman <sf...@apache.org>
Authored: Thu Nov 12 12:34:46 2015 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Thu Nov 12 12:34:46 2015 -0700

----------------------------------------------------------------------
 .../asyncevents/AmazonAsyncEventService.java     | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/c068ab0d/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AmazonAsyncEventService.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AmazonAsyncEventService.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AmazonAsyncEventService.java
index a4b7ef7..e99c052 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AmazonAsyncEventService.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AmazonAsyncEventService.java
@@ -22,9 +22,7 @@ package org.apache.usergrid.corepersistence.asyncevents;
 
 import java.io.IOException;
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.stream.Collectors;
@@ -573,18 +571,25 @@ public class AmazonAsyncEventService implements AsyncEventService {
      * @param indexOperationMessage
      */
     private void initializeEntityIndexes(final IndexOperationMessage indexOperationMessage) {
+        Map<UUID,Boolean> apps = new HashMap<>(indexOperationMessage.getIndexRequests().size()+indexOperationMessage.getDeIndexRequests().size());
         //loop through all adds
         indexOperationMessage.getIndexRequests().stream().forEach(req -> {
             UUID appId = IndexingUtils.getApplicationIdFromIndexDocId(req.documentId);
-            ApplicationScope appScope = CpNamingUtils.getApplicationScope(appId);
-            entityIndexFactory.createEntityIndex(indexLocationStrategyFactory.getIndexLocationStrategy(appScope));
+            if(!apps.containsKey(appId)) {
+                ApplicationScope appScope = CpNamingUtils.getApplicationScope(appId);
+                entityIndexFactory.createEntityIndex(indexLocationStrategyFactory.getIndexLocationStrategy(appScope));
+                apps.put(appId,true);
+            }
         });
 
         //loop through all deletes
         indexOperationMessage.getDeIndexRequests().stream().forEach(req -> {
             UUID appId = IndexingUtils.getApplicationIdFromIndexDocId(req.documentId);
-            ApplicationScope appScope = CpNamingUtils.getApplicationScope(appId);
-            entityIndexFactory.createEntityIndex(indexLocationStrategyFactory.getIndexLocationStrategy(appScope));
+            if(!apps.containsKey(appId)) {
+                ApplicationScope appScope = CpNamingUtils.getApplicationScope(appId);
+                entityIndexFactory.createEntityIndex(indexLocationStrategyFactory.getIndexLocationStrategy(appScope));
+                apps.put(appId,true);
+            }
         });
     }