You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2022/06/14 06:36:29 UTC

[pulsar] branch master updated: [Broker] Terminate JVM when initialize-cluster-metadata command fails (#16039)

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

lhotari 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 eb9e0aa8646 [Broker] Terminate JVM when initialize-cluster-metadata command fails (#16039)
eb9e0aa8646 is described below

commit eb9e0aa8646ed405f4e791cf13791286624a9473
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Tue Jun 14 09:36:13 2022 +0300

    [Broker] Terminate JVM when initialize-cluster-metadata command fails (#16039)
    
    - the script gets stuck unless the JVM is terminated explicitly
---
 .../java/org/apache/pulsar/PulsarClusterMetadataSetup.java    | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataSetup.java b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataSetup.java
index 1dbb480f29d..9d7aac38a5c 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataSetup.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataSetup.java
@@ -232,6 +232,17 @@ public class PulsarClusterMetadataSetup {
             System.exit(1);
         }
 
+        try {
+            initializeCluster(arguments);
+        } catch (Exception e) {
+            System.err.println("Unexpected error occured.");
+            e.printStackTrace(System.err);
+            System.err.println("Terminating JVM...");
+            Runtime.getRuntime().halt(1);
+        }
+    }
+
+    private static void initializeCluster(Arguments arguments) throws Exception {
         log.info("Setting up cluster {} with metadata-store={} configuration-metadata-store={}", arguments.cluster,
                 arguments.metadataStoreUrl, arguments.configurationMetadataStore);