Skip to content

Commit eafbc38

Browse files
committed
Creates the zookeeper root node if it doesn't exist
1 parent 1421bfa commit eafbc38

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/org/computate/frFR/java/RegarderRepertoire.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ private void regarderClasseEvenement(Message<Object> message) {
617617
LOG.info(log);
618618
promise.complete();
619619
} catch(Exception ex) {
620-
if(!(ex instanceof KeeperException))
620+
if(!(ex instanceof KeeperException.NodeExistsException))
621621
LOG.error("Une Problème d'exécution de RegarderRepertoire. ", ex);
622622
}
623623
return promise.future();
@@ -824,6 +824,12 @@ public void start(Promise<Void> startPromise) throws Exception {
824824
}
825825
}, zkClientConfig);
826826
connectionLatch.await();
827+
Stat zookeeperStat = new Stat();
828+
try {
829+
zookeeper.create(String.format("/%s", ZOOKEEPER_ROOT_PATH), "reserved".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL, zookeeperStat);
830+
} catch(KeeperException.NodeExistsException ex) {
831+
LOG.info(String.format("The zookeeper root node already exists: %s", String.format("/%s", ZOOKEEPER_ROOT_PATH)));
832+
}
827833

828834
trace = true;
829835
initialiserRegarderRepertoire(classeLangueConfig);

0 commit comments

Comments
 (0)