airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject [1/2] git commit: fixing synchronizing issue with the monitoring queueu
Date Sat, 11 Oct 2014 17:28:34 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 2fa6af64b -> 7496f507f


fixing synchronizing issue with the monitoring queueu


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/3989e08f
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/3989e08f
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/3989e08f

Branch: refs/heads/master
Commit: 3989e08fb2d728b901a685ec2e633019fbd06038
Parents: 7781079
Author: lahiru <lahiru@apache.org>
Authored: Sat Oct 11 13:26:38 2014 -0400
Committer: lahiru <lahiru@apache.org>
Committed: Sat Oct 11 13:26:38 2014 -0400

----------------------------------------------------------------------
 .../gfac/monitor/impl/pull/qstat/HPCPullMonitor.java    | 12 ++++++------
 .../apache/airavata/gfac/monitor/util/CommonUtils.java  |  8 ++++++--
 2 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/3989e08f/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
index 6f09a3c..91d5369 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
@@ -113,12 +113,12 @@ public class HPCPullMonitor extends PullMonitor {
         this.startPulling = true;
         while (this.startPulling && !ServerSettings.isStopAllThreads()) {
             try {
-                if (this.queue.size() > 0) {
-                    synchronized (this.queue) {
+                // After finishing one iteration of the full queue this thread sleeps 1 second
+                synchronized (this.queue) {
+                    if (this.queue.size() > 0) {
                         startPulling();
-                    }
                 }
-                // After finishing one iteration of the full queue this thread sleeps 1 second
+            }
                 Thread.sleep(10000);
             } catch (Exception e) {
                 // we catch all the exceptions here because no matter what happens we do
not stop running this
@@ -290,8 +290,8 @@ public class HPCPullMonitor extends PullMonitor {
             for (String jobName: keys) {
                 MonitorID completedJob = completedJobs.get(jobName);
                 CommonUtils.removeMonitorFromQueue(queue, completedJob);
-//                    gfac.invokeOutFlowHandlers(completedJob.getJobExecutionContext());
-                  GFacThreadPoolExecutor.getFixedThreadPool().submit(new OutHandlerWorker(gfac,
completedJob, publisher));
+                    gfac.invokeOutFlowHandlers(completedJob.getJobExecutionContext());
+//                  GFacThreadPoolExecutor.getFixedThreadPool().submit(new OutHandlerWorker(gfac,
completedJob, publisher));
                 if (zk == null) {
                     zk = completedJob.getJobExecutionContext().getZk();
                 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/3989e08f/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
index 25f884d..3abcf1d 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
@@ -146,8 +146,13 @@ public class CommonUtils {
         return true;
     }
 
+    /**
+     * This method doesn't have to be synchronized because it will be invoked by HPCPullMonitor
which already synchronized
+     * @param queue
+     * @param monitorID
+     * @throws AiravataMonitorException
+     */
     public static void removeMonitorFromQueue(BlockingQueue<UserMonitorData> queue,
MonitorID monitorID) throws AiravataMonitorException {
-        synchronized (queue) {
             Iterator<UserMonitorData> iterator = queue.iterator();
             while (iterator.hasNext()) {
                 UserMonitorData next = iterator.next();
@@ -185,7 +190,6 @@ public class CommonUtils {
                     }
                 }
             }
-        }
         logger.info("Cannot find the given MonitorID in the queue with userName " +
                 monitorID.getUserName() + "  and jobID " + monitorID.getJobID());
         logger.info("This might not be an error because someone else removed this job from
the queue");


Mime
View raw message