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/10/07 21:27:26 UTC
[10/17] git commit: one less update in the case of no devices
one less update in the case of no devices
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/ef8a8c6e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/ef8a8c6e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/ef8a8c6e
Branch: refs/heads/two-dot-o-events
Commit: ef8a8c6e34aa41b7d47395405b4a469a0771a474
Parents: bdb9795
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Oct 7 11:15:24 2014 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Oct 7 11:15:24 2014 -0600
----------------------------------------------------------------------
.../services/notifications/ApplicationQueueManager.java | 11 +++++------
.../usergrid/services/notifications/TaskManager.java | 8 ++++++--
2 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ef8a8c6e/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 5d2e554..b36d1fe 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
@@ -223,7 +223,6 @@ public class ApplicationQueueManager {
notification.addProperties(properties);
long now = System.currentTimeMillis();
- em.update(notification);
LOG.info("notification {} updated notification duration {} ms", notification.getUuid(),System.currentTimeMillis() - now);
@@ -231,13 +230,13 @@ public class ApplicationQueueManager {
if (deviceCount.get() <= 0) {
TaskManager taskManager = new TaskManager(em, this, notification);
//if i'm in a test value will be false, do not mark finished for test orchestration, not ideal need real tests
- taskManager.finishedBatch();
+ taskManager.finishedBatch(false);
}
- if (LOG.isInfoEnabled()) {
- long elapsed = notification.getQueued() != null ? notification.getQueued() - startTime : 0;
- LOG.info("notification {} done queuing to {} devices in "+elapsed+" ms",notification.getUuid().toString(),deviceCount.get());
- }
+ em.update(notification);
+
+ long elapsed = notification.getQueued() != null ? notification.getQueued() - startTime : 0;
+ LOG.info("notification {} done queuing to {} devices in " + elapsed + " ms", notification.getUuid().toString(), deviceCount.get());
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ef8a8c6e/stack/services/src/main/java/org/apache/usergrid/services/notifications/TaskManager.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/TaskManager.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/TaskManager.java
index ecbda93..0baa17f 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/TaskManager.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/TaskManager.java
@@ -134,8 +134,10 @@ public class TaskManager {
}
}
}
-
public void finishedBatch() throws Exception {
+ finishedBatch(true);
+ }
+ public void finishedBatch(boolean update) throws Exception {
long successes = this.successes.get(); //reset counters
long failures = this.failures.get(); //reset counters
for (int i = 0; i < successes; i++) {
@@ -167,7 +169,9 @@ public class TaskManager {
notification.addProperties(properties);
LOG.info("notification finished batch: {} of {} devices", notification.getUuid(), totals);
- em.update(notification);
+ if (update){
+ em.update(notification);
+ }
// Set<Notifier> notifiers = new HashSet<>(proxy.getNotifierMap().values()); // remove dups
// proxy.asyncCheckForInactiveDevices(notifiers);
}