You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2014/09/21 00:30:39 UTC

[1/4] git commit: sleep after exception

Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o 24ed70792 -> ceaacc2c8


sleep after exception


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

Branch: refs/heads/two-dot-o
Commit: e5b06668b83c9ab5bf1b474a33d8a2754db9cd19
Parents: 7bcdf10
Author: Shawn Feldman <sf...@apache.org>
Authored: Sat Sep 20 14:52:00 2014 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Sat Sep 20 14:52:00 2014 -0600

----------------------------------------------------------------------
 .../apache/usergrid/services/notifications/QueueListener.java   | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e5b06668/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 7a4cd26..51f8f79 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
@@ -192,6 +192,11 @@ public class QueueListener  {
                 consecutiveExceptions.set(0);
             }catch (Exception ex){
                 LOG.error("failed to dequeue",ex);
+                try {
+                    Thread.sleep(sleepWhenNoneFound);
+                }catch (InterruptedException ie){
+                    LOG.info("sleep interupted");
+                }
                 if(consecutiveExceptions.getAndIncrement() > MAX_CONSECUTIVE_FAILS){
                     LOG.error("killing message listener; too many failures");
                     break;


[2/4] git commit: Merge branch 'two-dot-o' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into two-dot-o

Posted by sf...@apache.org.
Merge branch 'two-dot-o' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into two-dot-o


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

Branch: refs/heads/two-dot-o
Commit: d86e9d2e4366321b48d93ad809ac5ec1c5d1d978
Parents: e5b0666 385ce17
Author: Shawn Feldman <sf...@apache.org>
Authored: Sat Sep 20 15:46:56 2014 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Sat Sep 20 15:46:56 2014 -0600

----------------------------------------------------------------------
 stack/awscluster/ugcluster-cf.json | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[4/4] git commit: Merge branch 'two-dot-o' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into two-dot-o

Posted by sf...@apache.org.
Merge branch 'two-dot-o' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into two-dot-o


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

Branch: refs/heads/two-dot-o
Commit: ceaacc2c8da9073babd5cc68bc126aa512b35e52
Parents: eb0eef9 24ed707
Author: Shawn Feldman <sf...@apache.org>
Authored: Sat Sep 20 16:29:26 2014 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Sat Sep 20 16:29:26 2014 -0600

----------------------------------------------------------------------
 .../awscluster/src/main/dist/init_instance/install_yourkit.sh  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[3/4] git commit: remove all synchronized blocks

Posted by sf...@apache.org.
remove all synchronized blocks


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

Branch: refs/heads/two-dot-o
Commit: eb0eef9234de0ab90afbbfec8dbdf713320e799f
Parents: d86e9d2
Author: Shawn Feldman <sf...@apache.org>
Authored: Sat Sep 20 16:27:35 2014 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Sat Sep 20 16:27:35 2014 -0600

----------------------------------------------------------------------
 .../notifications/ApplicationQueueManager.java  |  9 ++++---
 .../services/notifications/QueueListener.java   | 25 ++++++++++----------
 .../notifications/SingleQueueTaskManager.java   |  8 +++----
 3 files changed, 20 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eb0eef92/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 b54c9c6..ee988dc 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
@@ -311,12 +311,11 @@ public class ApplicationQueueManager implements QueueManager {
                         notificationMap.put(message.getNotificationId(), notification);
                     }
                     SingleQueueTaskManager taskManager;
-                    synchronized (taskMap) {
+                    taskManager = taskMap.get(message.getNotificationId());
+                    if (taskManager == null) {
+                        taskManager = new SingleQueueTaskManager(em, qm, proxy, notification);
+                        taskMap.putIfAbsent(message.getNotificationId(), taskManager);
                         taskManager = taskMap.get(message.getNotificationId());
-                        if (taskManager == null) {
-                            taskManager = new SingleQueueTaskManager(em, qm, proxy, notification);
-                            taskMap.put(message.getNotificationId(), taskManager);
-                        }
                     }
 
                     final Map<String, Object> payloads = notification.getPayloads();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eb0eef92/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 51f8f79..65d99be 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
@@ -101,18 +101,17 @@ public class QueueListener  {
                 futures = new ArrayList<Future>(maxThreads);
                 while (threadCount++ < maxThreads) {
                     LOG.info("QueueListener: Starting thread {}.", threadCount);
-                    futures.add(
-                            pool.submit(new Runnable() {
-                                @Override
-                                public void run() {
-                                    try {
-                                        execute();
-                                    } catch (Exception e) {
-                                        LOG.error("failed to start push", e);
-                                    }
-                                }
-                            })
-                    );
+                    Runnable task = new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+                                execute();
+                            } catch (Exception e) {
+                                LOG.error("failed to start push", e);
+                            }
+                        }
+                    };
+                    futures.add( pool.submit(task));
                 }
             } catch (Exception e) {
                 LOG.error("QueueListener: failed to start:", e);
@@ -125,7 +124,7 @@ public class QueueListener  {
     }
 
     private void execute(){
-
+        Thread.currentThread().setName("Notifications_Processor"+UUID.randomUUID());
         svcMgr = smf.getServiceManager(smf.getManagementAppId());
         queueManager = svcMgr.getQueueManager();
         final AtomicInteger consecutiveExceptions = new AtomicInteger();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eb0eef92/stack/services/src/main/java/org/apache/usergrid/services/notifications/SingleQueueTaskManager.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/SingleQueueTaskManager.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/SingleQueueTaskManager.java
index 5af0493..4b11974 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/SingleQueueTaskManager.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/SingleQueueTaskManager.java
@@ -145,7 +145,7 @@ public class SingleQueueTaskManager implements NotificationsTaskManager {
     }
 
     public void finishedBatch() throws Exception {
-        synchronized (this) { //avoid issues with counting
+        //synchronized (this) { //avoid issues with counting
             long successes = this.successes.getAndSet(0); //reset counters
             long failures = this.failures.getAndSet(0); //reset counters
             this.hasFinished = true;
@@ -200,10 +200,10 @@ public class SingleQueueTaskManager implements NotificationsTaskManager {
             LOG.info("notification finished batch: {}", notification.getUuid());
             em.updateProperties(notification, properties);
             em.update(notification);
-        }
+       // }
 
-        Set<Notifier> notifiers = new HashSet<Notifier>(proxy.getNotifierMap().values()); // remove dups
-        proxy.asyncCheckForInactiveDevices(notifiers);
+        //Set<Notifier> notifiers = new HashSet<Notifier>(proxy.getNotifierMap().values()); // remove dups
+       // proxy.asyncCheckForInactiveDevices(notifiers);
     }