public void update ( String serverId ) throws AtlasBaseException { try { CuratorFramework client = curatorFactory . clientInstance ( ) ; HAConfiguration . ZookeeperProperties zookeeperProperties = HAConfiguration . getZookeeperProperties ( configuration ) ; String atlasServerAddress = HAConfiguration . getBoundAddressForId ( configuration , serverId ) ; List < ACL > acls = Arrays . asList ( new ACL [ ] { AtlasZookeeperSecurityProperties . parseAcl ( zookeeperProperties . getAcl ( ) , ZooDefs . Ids . OPEN_ACL_UNSAFE . get ( 0 ) ) } ) ; Stat serverInfo = client . checkExists ( ) . forPath ( getZnodePath ( zookeeperProperties ) ) ; if ( serverInfo == null ) { client . create ( ) . withMode ( CreateMode . EPHEMERAL ) . withACL ( acls ) . forPath ( getZnodePath ( zookeeperProperties ) ) ; } client . setData ( ) . forPath ( getZnodePath ( zookeeperProperties ) , atlasServerAddress . getBytes ( Charset . forName ( "UTF-8" ) ) ) ; } catch ( Exception e ) { throw new AtlasBaseException ( AtlasErrorCode . CURATOR_FRAMEWORK_UPDATE , e , "forPath: getZnodePath" ) ; } }
Update state of the active server instance .