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/23 01:37:21 UTC
git commit: simple stats
Repository: incubator-usergrid
Updated Branches:
refs/heads/two-dot-o 5e111408c -> d046ca1a0
simple stats
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/d046ca1a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/d046ca1a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/d046ca1a
Branch: refs/heads/two-dot-o
Commit: d046ca1a0778fafdc0576c671d6a009cce6d8a37
Parents: 5e11140
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Sep 22 13:58:26 2014 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Sep 22 17:37:03 2014 -0600
----------------------------------------------------------------------
.../notifications/SingleQueueTaskManager.java | 41 +++-----------------
1 file changed, 5 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d046ca1a/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 2313853..75b2212 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
@@ -153,35 +153,9 @@ public class SingleQueueTaskManager implements NotificationsTaskManager {
Notification notification = em.get(this.notification.getUuid(), Notification.class);
notification.setModified(System.currentTimeMillis());
- Map<String, Long> stats;
- String statsKey = "statistics_batch";
- Map<String, Object> properties;
- //write out current results to a set so no overlap in multiple writes will occur
- if (successes + failures > 0) {
- properties = new HashMap<String, Object>(4);
- stats = new HashMap<String, Long>(2);
- stats.put("sent", successes);
- stats.put("errors", failures);
- properties.put(statsKey + "_" + System.currentTimeMillis(), stats);
- properties.put("modified", notification.getModified());
- notification.addProperties(properties);
- em.update(notification);
- }
-
- //resum the stats
- notification = em.get(this.notification.getUuid(), Notification.class); // re-read
- properties = notification.getProperties();
- long sent = 0;
- long errors = 0;
- for (String key : properties.keySet()) {
- if (key.contains(statsKey)) {
- stats = (Map<String, Long>) properties.get(key);
- sent += stats.get("sent");
- errors += stats.get("errors");
- }
- }
-
+ long sent = successes,errors = failures;
//and write them out again, this will produce the most accurate count
+ Map<String, Long> stats;
stats = new HashMap<String, Long>(2);
stats.put("sent", sent);
stats.put("errors", errors);
@@ -191,22 +165,17 @@ public class SingleQueueTaskManager implements NotificationsTaskManager {
//none of this is known and should you ever do this
if (notification.getExpectedCount() <= (errors + sent)) {
+ Map<String, Object> properties = new HashMap<>();
notification.setFinished(notification.getModified());
properties.put("finished", notification.getModified());
properties.put("state", notification.getState());
LOG.info("done sending to devices in {} ms", notification.getFinished() - notification.getStarted());
notification.addProperties(properties);
}
-
LOG.info("notification finished batch: {}", notification.getUuid());
em.update(notification);
- // Set<Notifier> notifiers = new HashSet<Notifier>(proxy.getNotifierMap().values()); // remove dups
- //proxy.asyncCheckForInactiveDevices(notifiers);
- }
-
-
- protected void hasFinished(boolean hasFinished) {
- this.hasFinished = hasFinished;
+// Set<Notifier> notifiers = new HashSet<>(proxy.getNotifierMap().values()); // remove dups
+// proxy.asyncCheckForInactiveDevices(notifiers);
}
}
\ No newline at end of file