@Override public void set_ephemeral_node(String path, byte[] data, List<ACL> acls) { stateStorage.set_ephemeral_node(path, data, acls); }
@Override public void supervisorHeartbeat(String supervisorId, SupervisorInfo info) { String path = ClusterUtils.supervisorPath(supervisorId); stateStorage.set_ephemeral_node(path, Utils.serialize(info), defaultAcls); }
@Override public void addNimbusHost(final String nimbusId, final NimbusSummary nimbusSummary) { // explicit delete for ephmeral node to ensure this session creates the entry. stateStorage.delete_node(ClusterUtils.nimbusPath(nimbusId)); stateStorage.add_listener((curatorFramework, connectionState) -> { LOG.info("Connection state listener invoked, zookeeper connection state has changed to {}", connectionState); if (connectionState.equals(ConnectionState.RECONNECTED)) { LOG.info("Connection state has changed to reconnected so setting nimbuses entry one more time"); // explicit delete for ephemeral node to ensure this session creates the entry. stateStorage.delete_node(ClusterUtils.nimbusPath(nimbusId)); stateStorage.set_ephemeral_node(ClusterUtils.nimbusPath(nimbusId), Utils.serialize(nimbusSummary), defaultAcls); } }); stateStorage.set_ephemeral_node(ClusterUtils.nimbusPath(nimbusId), Utils.serialize(nimbusSummary), defaultAcls); }
@Override public void setupBlob(String key, NimbusInfo nimbusInfo, Integer versionInfo) { String path = ClusterUtils.blobstorePath(key) + ClusterUtils.ZK_SEPERATOR + nimbusInfo.toHostPortString() + "-" + versionInfo; LOG.info("set-path: {}", path); stateStorage.mkdirs(ClusterUtils.blobstorePath(key), defaultAcls); stateStorage.delete_node_blobstore(ClusterUtils.blobstorePath(key), nimbusInfo.toHostPortString()); stateStorage.set_ephemeral_node(path, null, defaultAcls); }
@Override public void supervisorHeartbeat(String supervisorId, SupervisorInfo info) { String path = ClusterUtils.supervisorPath(supervisorId); stateStorage.set_ephemeral_node(path, Utils.serialize(info), acls); }
@Override public void stateChanged(CuratorFramework curatorFramework, ConnectionState connectionState) { LOG.info("Connection state listener invoked, zookeeper connection state has changed to {}", connectionState); if (connectionState.equals(ConnectionState.RECONNECTED)) { LOG.info("Connection state has changed to reconnected so setting nimbuses entry one more time"); // explicit delete for ephmeral node to ensure this session creates the entry. stateStorage.delete_node(ClusterUtils.nimbusPath(nimbusId)); stateStorage.set_ephemeral_node(ClusterUtils.nimbusPath(nimbusId), Utils.serialize(nimbusSummary), acls); } } });
/** * if znode exists and to be not on?, delete; if exists and on?, do nothing; if not exists and to be on?, create; if not exists and not on?, do nothing; * * @param stormId * @param node * @param port * @param on */ @Override public void workerBackpressure(String stormId, String node, Long port, boolean on) { String path = ClusterUtils.backpressurePath(stormId, node, port); boolean existed = stateStorage.node_exists(path, false); if (existed) { if (on == false) stateStorage.delete_node(path); } else { if (on == true) { stateStorage.set_ephemeral_node(path, null, acls); } } }
@Override public void setupBlobstore(String key, NimbusInfo nimbusInfo, Integer versionInfo) { String path = ClusterUtils.blobstorePath(key) + ClusterUtils.ZK_SEPERATOR + nimbusInfo.toHostPortString() + "-" + versionInfo; LOG.info("set-path: {}", path); stateStorage.mkdirs(ClusterUtils.blobstorePath(key), acls); stateStorage.delete_node_blobstore(ClusterUtils.blobstorePath(key), nimbusInfo.toHostPortString()); stateStorage.set_ephemeral_node(path, null, acls); }
@Override public void addNimbusHost(final String nimbusId, final NimbusSummary nimbusSummary) { // explicit delete for ephmeral node to ensure this session creates the entry. stateStorage.delete_node(ClusterUtils.nimbusPath(nimbusId)); stateStorage.add_listener(new ConnectionStateListener() { @Override public void stateChanged(CuratorFramework curatorFramework, ConnectionState connectionState) { LOG.info("Connection state listener invoked, zookeeper connection state has changed to {}", connectionState); if (connectionState.equals(ConnectionState.RECONNECTED)) { LOG.info("Connection state has changed to reconnected so setting nimbuses entry one more time"); // explicit delete for ephmeral node to ensure this session creates the entry. stateStorage.delete_node(ClusterUtils.nimbusPath(nimbusId)); stateStorage.set_ephemeral_node(ClusterUtils.nimbusPath(nimbusId), Utils.serialize(nimbusSummary), acls); } } }); stateStorage.set_ephemeral_node(ClusterUtils.nimbusPath(nimbusId), Utils.serialize(nimbusSummary), acls); }