Return-Path: X-Original-To: apmail-airavata-commits-archive@www.apache.org Delivered-To: apmail-airavata-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 82BBE17CD7 for ; Sat, 11 Oct 2014 17:28:35 +0000 (UTC) Received: (qmail 27434 invoked by uid 500); 11 Oct 2014 17:28:35 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 27312 invoked by uid 500); 11 Oct 2014 17:28:35 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 27296 invoked by uid 99); 11 Oct 2014 17:28:35 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Oct 2014 17:28:35 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C5C9E893761; Sat, 11 Oct 2014 17:28:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lahiru@apache.org To: commits@airavata.apache.org Date: Sat, 11 Oct 2014 17:28:34 -0000 Message-Id: <9beab9e2cec94f479deacf41f11a0445@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] git commit: fixing synchronizing issue with the monitoring queueu 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 Authored: Sat Oct 11 13:26:38 2014 -0400 Committer: lahiru 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 queue, MonitorID monitorID) throws AiravataMonitorException { - synchronized (queue) { Iterator 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");