Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 640D9200C7C for ; Sat, 15 Apr 2017 19:50:16 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6299C160B8B; Sat, 15 Apr 2017 17:50:16 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8C788160BB1 for ; Sat, 15 Apr 2017 19:50:15 +0200 (CEST) Received: (qmail 44053 invoked by uid 500); 15 Apr 2017 17:50:14 -0000 Mailing-List: contact commits-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list commits@flink.apache.org Received: (qmail 43740 invoked by uid 99); 15 Apr 2017 17:50:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 Apr 2017 17:50:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9DFCFE382D; Sat, 15 Apr 2017 17:50:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: chesnay@apache.org To: commits@flink.apache.org Date: Sat, 15 Apr 2017 17:50:19 -0000 Message-Id: <1847eb06307e4e8c8cc98164a61f3b5b@git.apache.org> In-Reply-To: <45070f803513409e9af3fa39106ecc49@git.apache.org> References: <45070f803513409e9af3fa39106ecc49@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [7/7] flink git commit: [FLINK-6143] [clients] Fix unprotected access to this.flink in LocalExecutor#endSession. archived-at: Sat, 15 Apr 2017 17:50:16 -0000 [FLINK-6143] [clients] Fix unprotected access to this.flink in LocalExecutor#endSession. This closes #3710. Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/283f5efd Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/283f5efd Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/283f5efd Branch: refs/heads/master Commit: 283f5efd50bdb3e94cc947d1edab6fc0c8cbc77e Parents: 705938e Author: zhangminglei Authored: Tue Apr 11 23:29:50 2017 +0800 Committer: zentol Committed: Sat Apr 15 17:16:26 2017 +0200 ---------------------------------------------------------------------- .../java/org/apache/flink/client/LocalExecutor.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/283f5efd/flink-clients/src/main/java/org/apache/flink/client/LocalExecutor.java ---------------------------------------------------------------------- diff --git a/flink-clients/src/main/java/org/apache/flink/client/LocalExecutor.java b/flink-clients/src/main/java/org/apache/flink/client/LocalExecutor.java index e0367a5..20a3366 100644 --- a/flink-clients/src/main/java/org/apache/flink/client/LocalExecutor.java +++ b/flink-clients/src/main/java/org/apache/flink/client/LocalExecutor.java @@ -132,7 +132,9 @@ public class LocalExecutor extends PlanExecutor { @Override public boolean isRunning() { - return flink != null; + synchronized (lock) { + return flink != null; + } } /** @@ -218,10 +220,12 @@ public class LocalExecutor extends PlanExecutor { @Override public void endSession(JobID jobID) throws Exception { - LocalFlinkMiniCluster flink = this.flink; - if (flink != null) { - ActorGateway leaderGateway = flink.getLeaderGateway(AkkaUtils.getDefaultTimeoutAsFiniteDuration()); - leaderGateway.tell(new JobManagerMessages.RemoveCachedJob(jobID)); + synchronized (LocalExecutor.class) { + LocalFlinkMiniCluster flink = this.flink; + if (flink != null) { + ActorGateway leaderGateway = flink.getLeaderGateway(AkkaUtils.getDefaultTimeoutAsFiniteDuration()); + leaderGateway.tell(new JobManagerMessages.RemoveCachedJob(jobID)); + } } }