[STORM-2744] Address review comments
Project: http://git-wip-us.apache.org/repos/asf/storm/repo Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/de0118d3 Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/de0118d3 Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/de0118d3 Branch: refs/heads/master Commit: de0118d3c80d5bcf67aa20fb4b15743bc7fc2a5b Parents: 884eb61 Author: Ethan Li <[email protected]> Authored: Fri Sep 22 10:14:49 2017 -0500 Committer: Ethan Li <[email protected]> Committed: Fri Sep 22 10:14:49 2017 -0500 ---------------------------------------------------------------------- .../org/apache/storm/cluster/StormClusterStateImpl.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/storm/blob/de0118d3/storm-client/src/jvm/org/apache/storm/cluster/StormClusterStateImpl.java ---------------------------------------------------------------------- diff --git a/storm-client/src/jvm/org/apache/storm/cluster/StormClusterStateImpl.java b/storm-client/src/jvm/org/apache/storm/cluster/StormClusterStateImpl.java index 4d7e2a5..7a52d86 100644 --- a/storm-client/src/jvm/org/apache/storm/cluster/StormClusterStateImpl.java +++ b/storm-client/src/jvm/org/apache/storm/cluster/StormClusterStateImpl.java @@ -424,21 +424,21 @@ public class StormClusterStateImpl implements IStormClusterState { } /** - * If znode exists and timestamp is 0, delete; + * If znode exists and timestamp is non-positive, delete; * if exists and timestamp is larger than 0, update the timestamp; * if not exists and timestamp is larger than 0, create the znode and set the timestamp; - * if not exists and timestamp is 0, do nothing. + * if not exists and timestamp is non-positive, do nothing. * @param stormId The topology Id * @param node The node id * @param port The port number - * @param timestamp The backpressure timestamp. 0 means turning off the worker backpressure + * @param timestamp The backpressure timestamp. Non-positive means turning off the worker backpressure */ @Override public void workerBackpressure(String stormId, String node, Long port, long timestamp) { String path = ClusterUtils.backpressurePath(stormId, node, port); boolean existed = stateStorage.node_exists(path, false); if (existed) { - if (timestamp == 0) { + if (timestamp <= 0) { stateStorage.delete_node(path); } else { byte[] data = ByteBuffer.allocate(Long.BYTES).putLong(timestamp).array(); @@ -478,7 +478,7 @@ public class StormClusterStateImpl implements IStormClusterState { .max() .orElse(0); } - boolean ret = ((System.currentTimeMillis() - mostRecentTimestamp) < timeoutMs); + boolean ret = ((System.currentTimeMillis() - mostRecentTimestamp) < timeoutMs); LOG.debug("topology backpressure is {}", ret ? "on" : "off"); return ret; }
