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/08 17:40:50 UTC

[1/5] git commit: change to warn

Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o-events abd401447 -> c0c108f78


change to warn


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

Branch: refs/heads/two-dot-o-events
Commit: 7c8eb6281eb0e47c13a37ee24020be8ddf65856e
Parents: 3547f2c
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Oct 7 16:49:19 2014 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Oct 7 16:49:19 2014 -0600

----------------------------------------------------------------------
 .../usergrid/persistence/queue/impl/SQSQueueManagerImpl.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7c8eb628/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SQSQueueManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SQSQueueManagerImpl.java b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SQSQueueManagerImpl.java
index 240c380..260c9d4 100644
--- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SQSQueueManagerImpl.java
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SQSQueueManagerImpl.java
@@ -66,7 +66,7 @@ public class SQSQueueManagerImpl implements QueueManager {
             mapper.enable(SerializationFeature.INDENT_OUTPUT);
             mapper.enableDefaultTypingAsProperty(ObjectMapper.DefaultTyping.JAVA_LANG_OBJECT, "@class");
         } catch ( Exception e ) {
-            LOG.error("failed to setup SQS",e);
+            LOG.warn("failed to setup SQS",e);
 //            throw new RuntimeException("Error setting up mapper", e);
         }
     }


[4/5] git commit: add logging for failures only

Posted by sf...@apache.org.
add logging for failures only


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

Branch: refs/heads/two-dot-o-events
Commit: 13ae49b374d6d4aba65decb8a8bdfc50f02d7e49
Parents: 66c377d
Author: Shawn Feldman <sf...@apache.org>
Authored: Wed Oct 8 09:39:36 2014 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Wed Oct 8 09:39:36 2014 -0600

----------------------------------------------------------------------
 .../notifications/ApplicationQueueManager.java  |  7 +-
 .../services/notifications/TaskManager.java     | 85 +++++++++++---------
 2 files changed, 50 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/13ae49b3/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 079fd4b..b806bcb 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,10 +223,10 @@ public class ApplicationQueueManager  {
         LOG.info("notification {} updated notification duration {} ms", notification.getUuid(), System.currentTimeMillis() - now);
 
         //do i have devices, and have i already started batching.
-        if (deviceCount.get() <= 0 || notification.getDebug()) {
+        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(false);
+            taskManager.finishedBatch(false,true);
         }else {
             em.update(notification);
         }
@@ -378,8 +378,7 @@ public class ApplicationQueueManager  {
                                 try {
                                     TaskManager taskManager = taskMap.get(message.getNotificationId());
                                     notifications.put(message.getNotificationId(), message);
-                                    Notification notification = notificationMap.get(message.getNotificationId());
-                                    if(notification.getDebug())taskManager.finishedBatch();
+                                    taskManager.finishedBatch();
                                 } catch (Exception e) {
                                     LOG.error("Failed to finish batch", e);
                                 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/13ae49b3/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 a11ad45..03f036d 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
@@ -50,6 +50,13 @@ public class TaskManager {
         hasFinished = false;
     }
 
+    public long getSuccesses(){return successes.get();}
+
+    public long getFailures(){ return failures.get();}
+
+    public void completed(Notifier notifier, UUID deviceUUID) throws Exception {
+        completed(notifier,null,deviceUUID,null);
+    }
     public void completed(Notifier notifier, Receipt receipt, UUID deviceUUID, String newProviderId) throws Exception {
         LOG.debug("REMOVED {}", deviceUUID);
         try {
@@ -59,7 +66,7 @@ public class TaskManager {
             if (receipt != null) {
                 LOG.debug("notification {} sent to device {}. saving receipt.", notification.getUuid(), deviceUUID);
                 receipt.setSent(System.currentTimeMillis());
-                this.saveReceipt(notification, deviceRef, receipt);
+                this.saveReceipt(notification, deviceRef, receipt,false);
                 LOG.debug("notification {} receipt saved for device {}", notification.getUuid(), deviceUUID);
                 successes.incrementAndGet();
             }
@@ -97,10 +104,10 @@ public class TaskManager {
             }
             receipt.setErrorCode(code);
             receipt.setErrorMessage(message);
-            this.saveReceipt(notification, new SimpleEntityRef(Device.ENTITY_TYPE, deviceUUID), receipt);
+            this.saveReceipt(notification, new SimpleEntityRef(Device.ENTITY_TYPE, deviceUUID), receipt,true);
             LOG.debug("notification {} receipt saved for device {}", notification.getUuid(), deviceUUID);
         } finally {
-            completed(notifier, null, deviceUUID, null);
+            completed(notifier, deviceUUID);
         }
     }
 
@@ -108,8 +115,8 @@ public class TaskManager {
     * called from TaskManager - creates a persistent receipt and updates the
     * passed one w/ the UUID
     */
-    private void saveReceipt(EntityRef notification, EntityRef device, Receipt receipt) throws Exception {
-        if (this.notification.getDebug()) {
+    private void saveReceipt(EntityRef notification, EntityRef device, Receipt receipt, boolean hasError) throws Exception {
+        if (this.notification.getDebug() || hasError) {
             if (receipt.getUuid() == null) {
                 Receipt savedReceipt = em.create(receipt);
                 receipt.setUuid(savedReceipt.getUuid());
@@ -137,42 +144,44 @@ public class TaskManager {
         }
     }
     public void finishedBatch() throws Exception {
-        finishedBatch(true);
+        finishedBatch(true,false);
     }
-    public void finishedBatch(boolean fetch) throws Exception {
-        long successes = this.successes.get(); //reset counters
-        long failures = this.failures.get(); //reset counters
-        for (int i = 0; i < successes; i++) {
-            this.successes.decrementAndGet();
-        }
-        for (int i = 0; i < failures; i++) {
-            this.failures.decrementAndGet();
-        }
+    public void finishedBatch(boolean fetch, boolean force) throws Exception {
+        if (notification.getDebug() || getFailures() > 0 || force) {
+            long successes = this.successes.get(); //reset counters
+            long failures = this.failures.get(); //reset counters
+            for (int i = 0; i < successes; i++) {
+                this.successes.decrementAndGet();
+            }
+            for (int i = 0; i < failures; i++) {
+                this.failures.decrementAndGet();
+            }
 
-        this.hasFinished = true;
-
-        // refresh notification
-        if(fetch)
-            notification = em.get(this.notification.getUuid(), Notification.class);
-        notification.setModified(System.currentTimeMillis());
-
-        //and write them out again, this will produce the most accurate count
-        Map<String, Long> stats = new HashMap<>(2);
-        stats.put("sent", successes);
-        stats.put("errors", failures);
-        notification.updateStatistics(successes, failures);
-
-        long totals = (notification.getStatistics().get("sent") + notification.getStatistics().get("errors"));
-        //none of this is known and should you ever do this
-        Map<String, Object> properties = new HashMap<>();
-        notification.setFinished(notification.getModified());
-        properties.put("finished", notification.getModified());
-        properties.put("state", notification.getState());
-        notification.addProperties(properties);
-        long latency = notification.getFinished() - notification.getStarted();
-        LOG.info("notification finished batch: {} of {} devices in "+latency+"ms", notification.getUuid(), totals);
-        em.update(notification);
+            this.hasFinished = true;
+
+            // refresh notification
+            if (fetch)
+                notification = em.get(this.notification.getUuid(), Notification.class);
+            notification.setModified(System.currentTimeMillis());
+
+            //and write them out again, this will produce the most accurate count
+            Map<String, Long> stats = new HashMap<>(2);
+            stats.put("sent", successes);
+            stats.put("errors", failures);
+            notification.updateStatistics(successes, failures);
+
+            long totals = (notification.getStatistics().get("sent") + notification.getStatistics().get("errors"));
+            //none of this is known and should you ever do this
+            Map<String, Object> properties = new HashMap<>();
+            notification.setFinished(notification.getModified());
+            properties.put("finished", notification.getModified());
+            properties.put("state", notification.getState());
+            notification.addProperties(properties);
+            long latency = notification.getFinished() - notification.getStarted();
+            LOG.info("notification finished batch: {} of {} devices in " + latency + "ms", notification.getUuid(), totals);
+            em.update(notification);
 //        Set<Notifier> notifiers = new HashSet<>(proxy.getNotifierMap().values()); // remove dups
 //        proxy.asyncCheckForInactiveDevices(notifiers);
+        }
     }
 }
\ No newline at end of file


[5/5] git commit: Merge branch 'two-dot-o' into two-dot-o-events

Posted by sf...@apache.org.
Merge branch 'two-dot-o' into two-dot-o-events


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

Branch: refs/heads/two-dot-o-events
Commit: c0c108f78c7fcc60cd2f199843573d5841a545ee
Parents: abd4014 13ae49b
Author: Shawn Feldman <sf...@apache.org>
Authored: Wed Oct 8 09:40:21 2014 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Wed Oct 8 09:40:21 2014 -0600

----------------------------------------------------------------------
 .../persistence/entities/Notification.java      |  13 +++
 .../collection/EntityCollectionManagerIT.java   |  32 +++++-
 .../queue/impl/SQSQueueManagerImpl.java         |   2 +-
 .../notifications/ApplicationQueueManager.java  |  12 +--
 .../services/notifications/TaskManager.java     | 102 ++++++++++---------
 .../apns/NotificationsServiceIT.java            |  12 +++
 .../gcm/NotificationsServiceIT.java             |  10 ++
 7 files changed, 123 insertions(+), 60 deletions(-)
----------------------------------------------------------------------



[3/5] git commit: Test that illustrates update with no version problem.

Posted by sf...@apache.org.
Test that illustrates update with no version problem.


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

Branch: refs/heads/two-dot-o-events
Commit: 66c377df5b5323480d81530bfe2a00c7a803d023
Parents: 0b43040
Author: Dave Johnson <dm...@apigee.com>
Authored: Wed Oct 8 11:08:05 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Wed Oct 8 11:08:05 2014 -0400

----------------------------------------------------------------------
 .../collection/EntityCollectionManagerIT.java   | 32 +++++++++++++++++---
 1 file changed, 28 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/66c377df/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
index 1639d17..3d47e32 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
@@ -25,7 +25,6 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import org.apache.usergrid.persistence.collection.exception.CollectionRuntimeException;
 import org.apache.usergrid.persistence.collection.exception.WriteUniqueVerifyException;
 import org.apache.usergrid.persistence.collection.guice.MigrationManagerRule;
 import org.apache.usergrid.persistence.collection.guice.TestCollectionModule;
@@ -40,9 +39,6 @@ import com.google.inject.Inject;
 
 import rx.Observable;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 
 import static org.junit.Assert.*;
 
@@ -347,4 +343,32 @@ public class EntityCollectionManagerIT {
     }
 
 
+    @Test
+    public void updateVersioning() {
+
+        // create entity 
+        Entity origEntity = new Entity( new SimpleId( "testUpdate" ) );
+        origEntity.setField( new StringField( "testField", "value" ) );
+
+        CollectionScope context = new CollectionScopeImpl(
+            new SimpleId( "organization" ),  new SimpleId( "testUpdate" ), "testUpdate" );
+        EntityCollectionManager manager = factory.createCollectionManager( context );
+        Entity returned = manager.write(origEntity).toBlocking().lastOrDefault(null);
+
+        // note its version 
+        UUID oldVersion = returned.getVersion();
+
+        // partial update entity but we don't have version number
+        Entity updateEntity = new Entity( origEntity.getId() );
+        updateEntity.setField( new StringField("addedField", "other value" ) );
+        manager.update(origEntity).toBlocking().lastOrDefault(null);
+
+        // get entity now, it must have a new version
+        returned = manager.load(origEntity.getId() ).toBlocking().lastOrDefault(null);
+        UUID newVersion = returned.getVersion();
+
+        // this asswer fails
+        assertNotEquals( newVersion, oldVersion );
+    }
+
 }


[2/5] git commit: adding debug mode for notifications, to save us from logging

Posted by sf...@apache.org.
adding debug mode for notifications, to save us from logging


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

Branch: refs/heads/two-dot-o-events
Commit: 0b43040f326f26ba1ab3c6e2665c5c8dcc3961d3
Parents: 7c8eb62
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Oct 7 18:08:38 2014 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Oct 7 18:08:38 2014 -0600

----------------------------------------------------------------------
 .../persistence/entities/Notification.java      | 13 ++++++++
 .../notifications/ApplicationQueueManager.java  | 17 +++++------
 .../services/notifications/TaskManager.java     | 31 ++++++++++----------
 .../apns/NotificationsServiceIT.java            | 12 ++++++++
 .../gcm/NotificationsServiceIT.java             | 10 +++++++
 5 files changed, 57 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0b43040f/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Notification.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Notification.java b/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Notification.java
index d8e7242..4abb5b1 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Notification.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Notification.java
@@ -57,6 +57,10 @@ public class Notification extends TypedEntity {
     @EntityProperty
     protected Long queued;
 
+    /** Debug logging is on  */
+    @EntityProperty
+    protected boolean debug;
+
     /** Time send started */
     @EntityProperty
     protected Long started;
@@ -156,6 +160,15 @@ public class Notification extends TypedEntity {
     }
 
     @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+    public boolean getDebug() {
+        return debug;
+    }
+
+    public void setDebug(boolean debug) {
+        this.debug = debug;
+    }
+
+    @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
     public Long getStarted() {
         return started;
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0b43040f/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 7728111..079fd4b 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
@@ -203,16 +203,12 @@ public class ApplicationQueueManager  {
                     });
             o.toBlocking().lastOrDefault(null);
             LOG.info("notification {} done queueing duration {} ms", notification.getUuid(), System.currentTimeMillis() - now);
-
-
         }
 
         // update queued time
         Map<String, Object> properties = new HashMap<String, Object>(2);
         properties.put("queued", notification.getQueued());
         properties.put("state", notification.getState());
-
-
         if(errorMessages.size()>0){
             if (notification.getErrorMessage() == null) {
                 notification.setErrorMessage("There was a problem delivering all of your notifications. See deliveryErrors in properties");
@@ -224,17 +220,17 @@ public class ApplicationQueueManager  {
         long now = System.currentTimeMillis();
 
 
-        LOG.info("notification {} updated notification duration {} ms", notification.getUuid(),System.currentTimeMillis() - now);
+        LOG.info("notification {} updated notification duration {} ms", notification.getUuid(), System.currentTimeMillis() - now);
 
         //do i have devices, and have i already started batching.
-        if (deviceCount.get() <= 0) {
+        if (deviceCount.get() <= 0 || notification.getDebug()) {
             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(false,false);
+            taskManager.finishedBatch(false);
+        }else {
+            em.update(notification);
         }
 
-        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());
     }
@@ -382,7 +378,8 @@ public class ApplicationQueueManager  {
                                 try {
                                     TaskManager taskManager = taskMap.get(message.getNotificationId());
                                     notifications.put(message.getNotificationId(), message);
-                                    taskManager.finishedBatch();
+                                    Notification notification = notificationMap.get(message.getNotificationId());
+                                    if(notification.getDebug())taskManager.finishedBatch();
                                 } catch (Exception e) {
                                     LOG.error("Failed to finish batch", e);
                                 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0b43040f/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 4b55e95..a11ad45 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
@@ -109,15 +109,17 @@ public class TaskManager {
     * passed one w/ the UUID
     */
     private void saveReceipt(EntityRef notification, EntityRef device, Receipt receipt) throws Exception {
-        if (receipt.getUuid() == null) {
-            Receipt savedReceipt = em.create(receipt);
-            receipt.setUuid(savedReceipt.getUuid());
-
-            List<EntityRef> entities = Arrays.asList(notification, device);
-//            em.addToCollections(entities, Notification.RECEIPTS_COLLECTION, savedReceipt);
-        } else {
-            em.update(receipt);
+        if (this.notification.getDebug()) {
+            if (receipt.getUuid() == null) {
+                Receipt savedReceipt = em.create(receipt);
+                receipt.setUuid(savedReceipt.getUuid());
+                List<EntityRef> entities = Arrays.asList(notification, device);
+//              em.addToCollections(entities, Notification.RECEIPTS_COLLECTION, savedReceipt);
+            } else {
+                em.update(receipt);
+            }
         }
+
     }
 
     protected void replaceProviderId(EntityRef device, Notifier notifier,
@@ -135,9 +137,9 @@ public class TaskManager {
         }
     }
     public void finishedBatch() throws Exception {
-        finishedBatch(true,true);
+        finishedBatch(true);
     }
-    public void finishedBatch(boolean update, boolean fetch) throws Exception {
+    public void finishedBatch(boolean fetch) throws Exception {
         long successes = this.successes.get(); //reset counters
         long failures = this.failures.get(); //reset counters
         for (int i = 0; i < successes; i++) {
@@ -166,13 +168,10 @@ public class TaskManager {
         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: {} of {} devices", notification.getUuid(), totals);
-        if (update){
-            em.update(notification);
-        }
+        long latency = notification.getFinished() - notification.getStarted();
+        LOG.info("notification finished batch: {} of {} devices in "+latency+"ms", notification.getUuid(), totals);
+        em.update(notification);
 //        Set<Notifier> notifiers = new HashSet<>(proxy.getNotifierMap().values()); // remove dups
 //        proxy.asyncCheckForInactiveDevices(notifiers);
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0b43040f/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 f1d2dea..935f6b6 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
@@ -174,6 +174,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         payloads.put(notifier.getName().toString(), payload);
         app.put("payloads", payloads);
         app.put("queued", System.currentTimeMillis());
+        app.put("debug",true);
 
         // post notification to service manager
         Entity e = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
@@ -251,6 +252,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("payloads", payloads);
         app.put("started", System.currentTimeMillis());
         app.put("queued", System.currentTimeMillis());
+        app.put("debug",true);
 
         Query pQuery = new Query();
         pQuery.setLimit(100);
@@ -306,6 +308,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("payloads", payloads);
         app.put("deliver", System.currentTimeMillis() + 240000);
         app.put("queued", System.currentTimeMillis());
+        app.put("debug",true);
 
         Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
                 .getEntity();
@@ -352,6 +355,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
 
         app.clear();
         app.put("payloads", "{asdf}");
+        app.put("debug",true);
 
         try {
             Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
@@ -444,6 +448,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         payloads.put(notifier.getUuid().toString(), payload);
         properties.put("payloads", payloads);
         properties.put("queued", System.currentTimeMillis());
+        properties.put("debug",true);
 
         Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
                 .getEntity();
@@ -479,6 +484,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         payloads.put(notifierName, payload);
         app.put("payloads", payloads);
         app.put("queued", System.currentTimeMillis());
+        app.put("debug",true);
 
         Entity e = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
@@ -536,6 +542,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         payloads.put(notifier2Name, payload);
         app.put("payloads", payloads);
         app.put("queued", System.currentTimeMillis());
+        app.put("debug",true);
 
         e = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
@@ -596,6 +603,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         payloads.put(notifier2.getUuid().toString(), payload);
         app.put("payloads", payloads);
         app.put("queued", System.currentTimeMillis());
+        app.put("debug",true);
 
         e = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
@@ -663,6 +671,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         payloads.put(notifier.getUuid().toString(), payload);
         app.put("payloads", payloads);
         app.put("queued", System.currentTimeMillis());
+        app.put("debug",true);
 
         e = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
@@ -719,6 +728,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         payloads.put(notifier.getUuid().toString(), payload);
         app.put("payloads", payloads);
         app.put("queued", System.currentTimeMillis());
+        app.put("debug",true);
 
         Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
                 .getEntity();
@@ -785,6 +795,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         payloads.put(notifier.getUuid().toString(), payload);
         app.put("payloads", payloads);
         app.put("queued", System.currentTimeMillis());
+        app.put("debug",true);
 
         // create a notification
         entity = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
@@ -818,6 +829,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         payloads.put(notifier.getUuid().toString(), payload);
         app.put("payloads", payloads);
         app.put("queued", System.currentTimeMillis());
+        app.put("debug",true);
 
         // create a notification
         Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0b43040f/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 6edf0b5..81f1f77 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
@@ -143,6 +143,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         Map<String, String> payloads = new HashMap<String, String>(1);
         payloads.put("foo", payload);
         app.put("payloads", payloads);
+        app.put("debug",true);
         app.put("queued", System.currentTimeMillis());
 
         Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
@@ -173,6 +174,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         payloads.put(notifier.getUuid().toString(), payload);
         app.put("payloads", payloads);
         app.put("queued", System.currentTimeMillis());
+        app.put("debug",true);
 
         Entity e = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
@@ -218,6 +220,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         payloads.put(notifier.getUuid().toString(), payload);
         app.put("payloads", payloads);
         app.put("queued", System.currentTimeMillis());
+        app.put("debug",true);
         Entity e = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
 
@@ -241,6 +244,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         payloads.put(notifier.getUuid().toString(), payload);
         app.put("payloads", payloads);
         app.put("queued", System.currentTimeMillis());
+        app.put("debug",true);
 
         Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
                 .getEntity();
@@ -291,6 +295,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         payloads.put(notifier.getUuid().toString(), payload);
         app.put("payloads", payloads);
         app.put("queued", System.currentTimeMillis());
+        app.put("debug",true);
 
         Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
                 .getEntity();
@@ -320,6 +325,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
 
         app.clear();
         app.put("payloads", "{asdf}");
+        app.put("debug",true);
 
         try {
             app.testRequest(ServiceAction.POST, 1, "notifications");
@@ -363,6 +369,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
 
         app.clear();
         app.put("payloads", payloads);
+        app.put("debug",true);
 
         try {
             app.testRequest(ServiceAction.POST, 1, "notifications");
@@ -401,6 +408,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         payloads.put(notifier.getUuid().toString(), payload);
         app.put("payloads", payloads);
         app.put("queued", System.currentTimeMillis());
+        app.put("debug",true);
 
         Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
                 .getEntity();
@@ -457,6 +465,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         payloads.put(notifier.getUuid().toString(), payload);
         app.put("payloads", payloads);
         app.put("queued", System.currentTimeMillis());
+        app.put("debug",true);
 
         Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
                 .getEntity();
@@ -493,6 +502,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         payloads.put(notifier.getUuid().toString(), payload);
         properties.put("payloads", payloads);
         properties.put("queued", System.currentTimeMillis());
+        properties.put("debug",true);
 
         Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
                 .getEntity();