This is an automated email from the ASF dual-hosted git repository.

zjffdu pushed a commit to branch branch-0.8
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/branch-0.8 by this push:
     new a19f8c2  [HOTFIX] Fix compilation error
a19f8c2 is described below

commit a19f8c2f05d50f84dbb10ac7ea04fd66542b003b
Author: Jeff Zhang <zjf...@apache.org>
AuthorDate: Mon Apr 29 16:57:45 2019 +0800

    [HOTFIX] Fix compilation error
---
 .../lifecycle/TimeoutLifecycleManager.java         | 31 ++++++++++++----------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/lifecycle/TimeoutLifecycleManager.java
 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/lifecycle/TimeoutLifecycleManager.java
index 390159b..f9cd9c7 100644
--- 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/lifecycle/TimeoutLifecycleManager.java
+++ 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/lifecycle/TimeoutLifecycleManager.java
@@ -17,7 +17,7 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
 /**
  * This lifecycle manager would close interpreter after it is timeout. By 
default, it is timeout
  * after no using in 1 hour.
- *
+ * <p>
  * For now, this class only manage the lifecycle of interpreter group (will 
close interpreter
  * process after timeout). Managing the lifecycle of interpreter session could 
be done in future
  * if necessary.
@@ -40,24 +40,27 @@ public class TimeoutLifecycleManager implements 
LifecycleManager {
     this.timeoutThreshold = zConf.getLong(
         
ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_LIFECYCLE_MANAGER_TIMEOUT_THRESHOLD);
     this.checkScheduler = Executors.newScheduledThreadPool(1);
-    this.checkScheduler.scheduleAtFixedRate(() -> {
-      long now = System.currentTimeMillis();
-      for (Map.Entry<ManagedInterpreterGroup, Long> entry : 
interpreterGroups.entrySet()) {
-        ManagedInterpreterGroup interpreterGroup = entry.getKey();
-        Long lastTimeUsing = entry.getValue();
-        if ((now - lastTimeUsing) > timeoutThreshold) {
-          LOGGER.info("InterpreterGroup {} is timeout.", 
interpreterGroup.getId());
-          try {
-            interpreterGroup.close();
-          } catch (Exception e) {
-            LOGGER.warn("Fail to close interpreterGroup: " + 
interpreterGroup.getId(), e);
+    this.checkScheduler.scheduleAtFixedRate(new Runnable() {
+      @Override
+      public void run() {
+        long now = System.currentTimeMillis();
+        for (Map.Entry<ManagedInterpreterGroup, Long> entry : 
interpreterGroups.entrySet()) {
+          ManagedInterpreterGroup interpreterGroup = entry.getKey();
+          Long lastTimeUsing = entry.getValue();
+          if ((now - lastTimeUsing) > timeoutThreshold) {
+            LOGGER.info("InterpreterGroup {} is timeout.", 
interpreterGroup.getId());
+            try {
+              interpreterGroup.close();
+            } catch (Exception e) {
+              LOGGER.warn("Fail to close interpreterGroup: " + 
interpreterGroup.getId(), e);
+            }
+            interpreterGroups.remove(entry.getKey());
           }
-          interpreterGroups.remove(entry.getKey());
         }
       }
     }, checkInterval, checkInterval, MILLISECONDS);
     LOGGER.info("TimeoutLifecycleManager is started with checkinterval: " + 
checkInterval
-        + ", timeoutThreshold: " + timeoutThreshold);
+            + ", timeoutThreshold: " + timeoutThreshold);
   }
 
   @Override

Reply via email to