You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by sa...@apache.org on 2018/10/02 03:16:14 UTC

[pulsar] branch master updated: [function] Fix expected health check interval (#2684)

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

sanjeevrk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 054a784  [function] Fix expected health check interval (#2684)
054a784 is described below

commit 054a7840c8987dee9008f9a9e49393074a7c763c
Author: Sijie Guo <gu...@gmail.com>
AuthorDate: Mon Oct 1 20:16:10 2018 -0700

    [function] Fix expected health check interval (#2684)
    
    *Motivation*
    
    Java instance main is expecting health check interval in seconds.
    
    *Changes
    
    Make sure the health check interval is passed in seconds.
    
    *Tests*
    
    It fixes following issue
    
    ```
    14:36:29.528 [FunctionActionerThread] INFO  org.apache.pulsar.functions.runtime.ProcessRuntime - Started process successfully
    Exception in thread "main" java.lang.IllegalArgumentException
    	at java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate(ScheduledThreadPoolExecutor.java:565)
    	at java.util.concurrent.Executors$DelegatedScheduledExecutorService.scheduleAtFixedRate(Executors.java:735)
    	at org.apache.pulsar.functions.runtime.JavaInstanceMain.start(JavaInstanceMain.java:154)
    	at org.apache.pulsar.functions.runtime.JavaInstanceMain.main(JavaInstanceMain.java:185)
    ```
---
 .../main/java/org/apache/pulsar/functions/runtime/RuntimeFactory.java   | 2 ++
 .../main/java/org/apache/pulsar/functions/runtime/RuntimeSpawner.java   | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/RuntimeFactory.java b/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/RuntimeFactory.java
index fd8a7be..cae1ca0 100644
--- a/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/RuntimeFactory.java
+++ b/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/RuntimeFactory.java
@@ -30,6 +30,8 @@ public interface RuntimeFactory extends AutoCloseable {
      * Create a function container to execute a java instance.
      *
      * @param instanceConfig java instance config
+     * @param codeFile code file
+     * @param expectedHealthCheckInterval expected health check interval in seconds
      * @return function container to start/stop instance
      */
     Runtime createContainer(
diff --git a/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/RuntimeSpawner.java b/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/RuntimeSpawner.java
index d4d61e0..423ccd9 100644
--- a/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/RuntimeSpawner.java
+++ b/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/RuntimeSpawner.java
@@ -73,7 +73,7 @@ public class RuntimeSpawner implements AutoCloseable {
                 details.getName(), this.instanceConfig.getInstanceId());
 
         runtime = runtimeFactory.createContainer(this.instanceConfig, codeFile, originalCodeFileName,
-                instanceLivenessCheckFreqMs * 1000);
+                instanceLivenessCheckFreqMs / 1000);
         runtime.start();
 
         // monitor function runtime to make sure it is running.  If not, restart the function runtime