Repository: zeppelin Updated Branches: refs/heads/branch-0.7 4d80ec461 -> bd334d024
[HOTFIX] Restart button raises exception in interpreter side ### What is this PR for? This PR is the following one of #2140. It prevent from raising exception in interpreter side while closing interpreter. ### What type of PR is it? [Hot Fix] ### Todos * [x] - Remove open() while close() ### What is the Jira issue? N/A ### How should this be tested? N/A ### Screenshots (if appropriate) N/A ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Jongyoul Lee <jongy...@gmail.com> Closes #2147 from jongyoul/hotfix/restart-raise-exception and squashes the following commits: 12d6fa6 [Jongyoul Lee] Left comments 93b4c18 [Jongyoul Lee] Avoided opening interpreter while closing and calling close() in server side (cherry picked from commit dcee15afc3e2907b11991217d61967f2dbb3dfdf) Signed-off-by: Jongyoul Lee <jongy...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/bd334d02 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/bd334d02 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/bd334d02 Branch: refs/heads/branch-0.7 Commit: bd334d024cfab8d6227cbd1b7fcadae81b2ce271 Parents: 4d80ec4 Author: Jongyoul Lee <jongy...@gmail.com> Authored: Fri Mar 17 11:08:36 2017 +0900 Committer: Jongyoul Lee <jongy...@apache.org> Committed: Fri Mar 17 13:38:08 2017 +0900 ---------------------------------------------------------------------- .../apache/zeppelin/interpreter/LazyOpenInterpreter.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/bd334d02/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/LazyOpenInterpreter.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/LazyOpenInterpreter.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/LazyOpenInterpreter.java index ebecd10..0340632 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/LazyOpenInterpreter.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/LazyOpenInterpreter.java @@ -21,6 +21,7 @@ import java.net.URL; import java.util.List; import java.util.Properties; +import org.apache.zeppelin.interpreter.remote.RemoteInterpreter; import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion; import org.apache.zeppelin.scheduler.Scheduler; @@ -74,10 +75,12 @@ public class LazyOpenInterpreter @Override public void close() { - // To close interpreter, you should open it first. - open(); - intp.close(); - opened = false; + // TODO(jl): Remove this trick!! + // intp.close() should be called to reduce referenceCount + if (isOpen() || intp instanceof RemoteInterpreter) { + intp.close(); + opened = false; + } } public boolean isOpen() {