public void init ( ) throws IOException { try { if ( zooKeeper . exists ( zooKeeperParentPath , false ) == null ) { zooKeeper . create ( zooKeeperParentPath , new byte [ ] { ' ' } , ZooDefs . Ids . OPEN_ACL_UNSAFE , CreateMode . PERSISTENT ) ; LOG . info ( "Created ZNode " + zooKeeperParentPath ) ; } if ( zooKeeper . exists ( ledgerParentPath , false ) == null ) { zooKeeper . create ( ledgerParentPath , new byte [ ] { ' ' } , ZooDefs . Ids . OPEN_ACL_UNSAFE , CreateMode . PERSISTENT ) ; LOG . info ( "Created ZNode" + ledgerParentPath ) ; } } catch ( InterruptedException e ) { interruptedException ( "Interrupted ensuring that ZNodes " + zooKeeperParentPath + " and " + ledgerParentPath + " exist!" , e ) ; } catch ( KeeperException e ) { keeperException ( "Unrecoverable ZooKeeper error ensuring that ZNodes " + zooKeeperParentPath + " and " + ledgerParentPath + " exist!" , e ) ; } }
Create znodes for storing ledger metadata if they have not been created before