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/17 02:02:47 UTC
git commit: add more logging and move started logic out of scheduler
Repository: incubator-usergrid
Updated Branches:
refs/heads/two-dot-o c70920195 -> bd74c860a
add more logging and move started logic out of scheduler
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/bd74c860
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/bd74c860
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/bd74c860
Branch: refs/heads/two-dot-o
Commit: bd74c860ac52bdacca549f4fadfdaf944554534c
Parents: c709201
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Sep 16 18:02:30 2014 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Sep 16 18:02:30 2014 -0600
----------------------------------------------------------------------
.../notifications/ApplicationQueueManager.java | 5 ++++-
.../usergrid/services/notifications/JobScheduler.java | 10 ----------
.../services/notifications/NotificationsService.java | 14 ++++++++++++++
3 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bd74c860/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 1f103a7..3b0d5bd 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
@@ -106,6 +106,7 @@ public class ApplicationQueueManager implements QueueManager {
public void queueNotification(final Notification notification, final JobExecution jobExecution) throws Exception {
final Meter queueMeter = metricsFactory.getMeter(ApplicationQueueManager.class,"queue");
+ long startTime = System.currentTimeMillis();
if (notification.getCanceled() == Boolean.TRUE) {
LOG.info("ApplicationQueueMessage: notification " + notification.getUuid() + " canceled");
@@ -115,8 +116,8 @@ public class ApplicationQueueManager implements QueueManager {
return;
}
- long startTime = System.currentTimeMillis();
LOG.info("ApplicationQueueMessage: notification {} start queuing", notification.getUuid());
+
final PathQuery<Device> pathQuery = notification.getPathQuery() ; //devices query
final AtomicInteger deviceCount = new AtomicInteger(); //count devices so you can make a judgement on batching
final ConcurrentLinkedQueue<String> errorMessages = new ConcurrentLinkedQueue<String>(); //build up list of issues
@@ -259,6 +260,8 @@ public class ApplicationQueueManager implements QueueManager {
*/
public HashMap<Object,Notifier> getNotifierMap(){
if(notifierHashMap == null) {
+ LOG.info("ApplicationQueueManager: fetching notifiers start");
+
notifierHashMap = new HashMap<Object, Notifier>();
Query query = new Query();
query.setCollection("notifiers");
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bd74c860/stack/services/src/main/java/org/apache/usergrid/services/notifications/JobScheduler.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/JobScheduler.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/JobScheduler.java
index fa293ed..6015a0a 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/JobScheduler.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/JobScheduler.java
@@ -65,14 +65,6 @@ public class JobScheduler{
scheduleInFuture = false;
}
- // update Notification properties
- if (notification.getStarted() == null || notification.getStarted() == 0) {
- notification.setStarted(System.currentTimeMillis());
- Map<String, Object> properties = new HashMap<String, Object>(2);
- properties.put("started", notification.getStarted());
- properties.put("state", notification.getState());
- em.updateProperties(notification, properties);
- }
boolean scheduled = scheduleInFuture || forceSchedule;
if(scheduled) {
JobData jobData = new JobData();
@@ -81,8 +73,6 @@ public class JobScheduler{
jobData.setProperty("deliver", notification.getDeliver());
SchedulerService scheduler = getSchedulerService();
scheduler.createJob("queueJob", scheduleAt, jobData);
- }
- if(scheduled){
LOG.info("notification {} scheduled for queuing", notification.getUuid());
}
return scheduled;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bd74c860/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
index b3e0188..ea062c3 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
@@ -141,10 +141,24 @@ public class NotificationsService extends AbstractCollectionService {
context.setOwner(sm.getApplication());
ServiceResults results = super.postCollection(context);
Notification notification = (Notification) results.getEntity();
+
+ // update Notification properties
+ if (notification.getStarted() == null || notification.getStarted() == 0) {
+ LOG.info("ApplicationQueueMessage: notification {} properties updating", notification.getUuid());
+ notification.setStarted(System.currentTimeMillis());
+ Map<String, Object> properties = new HashMap<String, Object>(2);
+ properties.put("started", notification.getStarted());
+ properties.put("state", notification.getState());
+ em.updateProperties(notification, properties);
+ LOG.info("ApplicationQueueMessage: notification {} properties updated", notification.getUuid());
+ }
+
LOG.info("NotificationService: notification {} pre queue ", notification.getUuid());
+
if(!notificationQueueManager.scheduleQueueJob(notification)){
notificationQueueManager.queueNotification(notification, null);
}
+
outstandingQueue.inc();
LOG.info("NotificationService: notification {} post queue ", notification.getUuid());
// future: somehow return 202?