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/01 16:51:38 UTC

[02/35] git commit: setup default sleep window

setup default sleep window


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

Branch: refs/heads/two-dot-o-rebuildable-index
Commit: 05caf49325e52f806b3fdc22f18b70512f722d8c
Parents: f2a93d7
Author: Shawn Feldman <sf...@apache.org>
Authored: Fri Sep 26 11:23:19 2014 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Fri Sep 26 11:23:19 2014 -0600

----------------------------------------------------------------------
 .../services/notifications/ApplicationQueueManager.java         | 5 +++--
 .../apache/usergrid/services/notifications/QueueListener.java   | 3 ++-
 .../services/notifications/apns/NotificationsServiceIT.java     | 4 +++-
 .../services/notifications/gcm/NotificationsServiceIT.java      | 4 +++-
 4 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/05caf493/stack/services/src/main/java/org/apache/usergrid/services/notifications/ApplicationQueueManager.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/ApplicationQueueManager.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/ApplicationQueueManager.java
index 198d41a..766cb75 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/ApplicationQueueManager.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/ApplicationQueueManager.java
@@ -47,7 +47,7 @@ import java.util.concurrent.atomic.AtomicInteger;
  */
 public class ApplicationQueueManager implements QueueManager {
 
-    public static  String DEFAULT_QUEUE_NAME = "notifications/queuelistenerv1_12";
+    public static  String DEFAULT_QUEUE_NAME = "notifications/queuelistenerv1_20;notifications/queuelistenerv1_21";
     public static final String DEFAULT_QUEUE_PROPERTY = "usergrid.notifications.listener.queueName";
     private static final Logger LOG = LoggerFactory.getLogger(ApplicationQueueManager.class);
 
@@ -429,7 +429,8 @@ public class ApplicationQueueManager implements QueueManager {
     public static String getRandomQueue(String[] queueNames) {
         int size = queueNames.length;
         Random random = new Random();
-        return queueNames[random.nextInt(size)];
+        String name = queueNames[random.nextInt(size)];
+        return name;
     }
 
     private static final class IteratorObservable<T> implements rx.Observable.OnSubscribe<T> {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/05caf493/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 1d4c5cb..234821b 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
@@ -36,6 +36,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 public class QueueListener  {
     public static final long MESSAGE_TRANSACTION_TIMEOUT = 60 * 5 * 1000;
+    public static  long DEFAULT_SLEEP = 5000;
 
     private static final Logger LOG = LoggerFactory.getLogger(QueueListener.class);
 
@@ -91,7 +92,7 @@ public class QueueListener  {
 
             try {
                 sleepBetweenRuns = new Long(properties.getProperty("usergrid.notifications.listener.sleep.between", "0")).longValue();
-                sleepWhenNoneFound = new Long(properties.getProperty("usergrid.notifications.listener.sleep.after", "5000")).longValue();
+                sleepWhenNoneFound = new Long(properties.getProperty("usergrid.notifications.listener.sleep.after", ""+DEFAULT_SLEEP)).longValue();
                 batchSize = new Integer(properties.getProperty("usergrid.notifications.listener.batchSize", (""+batchSize)));
                 queueNames = ApplicationQueueManager.getQueueNames(properties);
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/05caf493/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
index ec7a14f..a47dc99 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
@@ -69,6 +69,9 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
     @Override
     @Before
     public void before() throws Exception {
+        ApplicationQueueManager.DEFAULT_QUEUE_NAME = "notifications/test/" + UUID.randomUUID().toString()+";"+"notifications/test/" + UUID.randomUUID().toString();
+
+        QueueListener.DEFAULT_SLEEP = 200;
         super.before();
         // create apns notifier //
         app.clear();
@@ -128,7 +131,6 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
 
         ns.TEST_PATH_QUERY = pathQuery;
 
-        ApplicationQueueManager.DEFAULT_QUEUE_NAME = "notifications/test/" + UUID.randomUUID().toString();
         listener = new QueueListener(ns.getServiceManagerFactory(),ns.getEntityManagerFactory(),ns.getMetricsFactory(), new Properties());
         listener.run();
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/05caf493/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
index 09814f3..eb3c8b8 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
@@ -63,6 +63,9 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
     @Override
     @Before
     public void before() throws Exception {
+        ApplicationQueueManager.DEFAULT_QUEUE_NAME = "notifications/test/" + UUID.randomUUID().toString()+";"+"notifications/test/" + UUID.randomUUID().toString();
+        QueueListener.DEFAULT_SLEEP = 200;
+
         super.before();
 
         // create gcm notifier //
@@ -102,7 +105,6 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         PathQuery pathQuery =  new PathQuery(new SimpleEntityRef(  app.getEm().getApplicationRef()), query);
 
         ns.TEST_PATH_QUERY = pathQuery;
-        ApplicationQueueManager.DEFAULT_QUEUE_NAME = "notifications/test/" + UUID.randomUUID().toString();
         listener = new QueueListener(ns.getServiceManagerFactory(),
                 ns.getEntityManagerFactory(),ns.getMetricsFactory(), new Properties());
         listener.run();