pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] jerrypeng commented on a change in pull request #1828: instance worker health check
Date Tue, 22 May 2018 05:48:43 GMT
jerrypeng commented on a change in pull request #1828: instance worker health check
URL: https://github.com/apache/incubator-pulsar/pull/1828#discussion_r189782719
 
 

 ##########
 File path: pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/JavaInstanceMain.java
 ##########
 @@ -186,34 +203,65 @@ public void start() throws Exception {
         instanceConfig.setFunctionDetails(functionDetails);
         instanceConfig.setPort(port);
 
+
         ThreadRuntimeFactory containerFactory = new ThreadRuntimeFactory(
                 "LocalRunnerThreadGroup",
                 pulsarServiceUrl,
                 stateStorageServiceUrl);
 
-        RuntimeSpawner runtimeSpawner = new RuntimeSpawner(
+        runtimeSpawner = new RuntimeSpawner(
                 instanceConfig,
                 jarFile,
                 containerFactory,
                 30000);
 
         server = ServerBuilder.forPort(port)
                 .addService(new InstanceControlImpl(runtimeSpawner))
-                .build()
-                .start();
-        log.info("JaveInstance Server started, listening on " + port);
-        java.lang.Runtime.getRuntime().addShutdownHook(new Thread() {
+                .build();
+
+        // monitor worker that spawned this process
+        timer = Executors.newSingleThreadScheduledExecutor();
+        handle = timer.scheduleAtFixedRate(new TimerTask() {
             @Override
             public void run() {
-                // Use stderr here since the logger may have been reset by its JVM shutdown
hook.
+                String uniqueWorkerId = null;
                 try {
-                    server.shutdown();
-                    runtimeSpawner.close();
+                    URL url = new URL("http://127.0.0.1:8080/admin/functions/id");
 
 Review comment:
   probably shouldn't hard code the port here

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message