From commits-return-8401-archive-asf-public=cust-asf.ponee.io@pulsar.incubator.apache.org Tue May 22 07:48:45 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 219D9180638 for ; Tue, 22 May 2018 07:48:44 +0200 (CEST) Received: (qmail 88084 invoked by uid 500); 22 May 2018 05:48:44 -0000 Mailing-List: contact commits-help@pulsar.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pulsar.incubator.apache.org Delivered-To: mailing list commits@pulsar.incubator.apache.org Received: (qmail 88075 invoked by uid 99); 22 May 2018 05:48:44 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 May 2018 05:48:44 +0000 From: GitBox To: commits@pulsar.apache.org Subject: [GitHub] jerrypeng commented on a change in pull request #1828: instance worker health check Message-ID: <152696812352.8585.3454710257643979188.gitbox@gitbox.apache.org> Date: Tue, 22 May 2018 05:48:43 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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