You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/10/29 20:21:44 UTC

[03/22] git commit: fix build error

fix build error


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

Branch: refs/heads/two-dot-o-events
Commit: 19aa1a620ac40eddb7e663c5510b83aa6476da94
Parents: e1b2e73
Author: Shawn Feldman <sf...@apache.org>
Authored: Fri Oct 24 16:11:52 2014 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Fri Oct 24 16:11:52 2014 -0600

----------------------------------------------------------------------
 .../services/notifications/QueueListener.java       | 16 ++++++++++++----
 .../services/notifications/TestAdapter.java         |  4 +---
 2 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/19aa1a62/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java
index 432ad7f..48c110b 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java
@@ -144,6 +144,8 @@ public class QueueListener  {
         QueueScope queueScope = queueScopeFactory.getScope(smf.getManagementAppId(), queueName);
         QueueManager queueManager = TEST_QUEUE_MANAGER != null ? TEST_QUEUE_MANAGER : queueManagerFactory.getQueueManager(queueScope);
         // run until there are no more active jobs
+        long runCount = 0;
+        Map<UUID,ApplicationQueueManager> queueManagerMap = new ConcurrentHashMap<>(); //keep a cache of queuemangers then clear them at an interval
         while ( true ) {
             try {
 
@@ -152,7 +154,7 @@ public class QueueListener  {
                 LOG.info("retrieved batch of {} messages from queue {} ", messages.size(),queueName);
 
                 if (messages.size() > 0) {
-                    Map<UUID,ApplicationQueueManager> queueManagerMap = new ConcurrentHashMap<>();
+                    runCount++;
                     HashMap<UUID, List<QueueMessage>> messageMap = new HashMap<>(messages.size());
                     //group messages into hash map by app id
                     for (QueueMessage message : messages) {
@@ -197,9 +199,7 @@ public class QueueListener  {
                         merge.toBlocking().lastOrDefault(null);
                     }
                     queueManager.commitMessages(messages);
-                    for(ApplicationQueueManager applicationQueueManager : queueManagerMap.values()){
-                        applicationQueueManager.asyncCheckForInactiveDevices();
-                    }
+
                     meter.mark(messages.size());
                     LOG.info("sent batch {} messages duration {} ms", messages.size(),System.currentTimeMillis() - now);
 
@@ -207,6 +207,14 @@ public class QueueListener  {
                         LOG.info("sleep between rounds...sleep...{}", sleepBetweenRuns);
                         Thread.sleep(sleepBetweenRuns);
                     }
+                    if(runCount % 100 == 0){
+                        for(ApplicationQueueManager applicationQueueManager : queueManagerMap.values()){
+                            applicationQueueManager.asyncCheckForInactiveDevices();
+                        }
+                        //clear everything
+                        queueManagerMap.clear();
+                        runCount=0;
+                    }
                 }
                 else{
                     LOG.info("no messages...sleep...{}", sleepWhenNoneFound);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/19aa1a62/stack/services/src/main/java/org/apache/usergrid/services/notifications/TestAdapter.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/TestAdapter.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/TestAdapter.java
index 2f28364..b4eb767 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/TestAdapter.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/TestAdapter.java
@@ -89,10 +89,8 @@ public class TestAdapter implements ProviderAdapter {
     }
 
     @Override
-    public Map<String, Date> getInactiveDevices(Notifier notifier,
-            EntityManager em) throws Exception {
+    public void removeInactiveDevices(Notifier notifier, EntityManager em) throws Exception {
         log.debug("getInactiveDevices()");
-        return null;
     }
 
     @Override