congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ClusterUtils.backpressureStormRoot
Code IndexAdd Tabnine to your IDE (free)

How to use
backpressureStormRoot
method
in
org.apache.storm.cluster.ClusterUtils

Best Java code snippets using org.apache.storm.cluster.ClusterUtils.backpressureStormRoot (Showing top 9 results out of 315)

origin: apache/storm

/**
 * Get the backpressure znode full path.
 *
 * @param stormId   The topology id
 * @param shortPath A string in the form of "node-port"
 * @return The backpressure znode path
 */
public static String backpressurePath(String stormId, String shortPath) {
  return backpressureStormRoot(stormId) + ZK_SEPERATOR + shortPath;
}
origin: apache/storm

public static String backpressurePath(String stormId, String node, Long port) {
  return backpressureStormRoot(stormId) + ZK_SEPERATOR + node + "-" + port;
}
origin: apache/storm

@Override
public void removeBackpressure(String stormId) {
  try {
    stateStorage.delete_node(ClusterUtils.backpressureStormRoot(stormId));
  } catch (Exception e) {
    if (Utils.exceptionCauseIsInstanceOf(KeeperException.class, e)) {
      // do nothing
      LOG.warn("Could not teardown backpressure node for {}.", stormId);
    } else {
      throw e;
    }
  }
}
origin: apache/storm

@Override
public void setupBackpressure(String stormId, Map<String, Object> topoConf) {
  stateStorage.mkdirs(ClusterUtils.BACKPRESSURE_SUBTREE, defaultAcls);
  stateStorage.mkdirs(ClusterUtils.backpressureStormRoot(stormId), ClusterUtils.mkTopoReadWriteAcls(topoConf));
}
origin: apache/storm

/**
 * Check whether a topology is in throttle-on status or not: if the backpresure/storm-id dir is not empty, this topology has
 * throttle-on, otherwise throttle-off. But if the backpresure/storm-id dir is not empty and has not been updated for more than
 * timeoutMs, we treat it as throttle-off. This will prevent the spouts from getting stuck indefinitely if something wrong happens.
 *
 * @param stormId   The topology Id
 * @param timeoutMs How long until the backpressure znode is invalid.
 * @param callback  The callback function
 * @return True is backpresure/storm-id dir is not empty and at least one of the backpressure znodes has not timed out; false otherwise.
 */
@Override
public boolean topologyBackpressure(String stormId, long timeoutMs, Runnable callback) {
  if (callback != null) {
    backPressureCallback.put(stormId, callback);
  }
  String path = ClusterUtils.backpressureStormRoot(stormId);
  long mostRecentTimestamp = 0;
  if (stateStorage.node_exists(path, false)) {
    List<String> children = stateStorage.get_children(path, callback != null);
    mostRecentTimestamp = children.stream()
                   .map(childPath -> stateStorage.get_data(ClusterUtils.backpressurePath(stormId, childPath), false))
                   .filter(data -> data != null)
                   .mapToLong(data -> ByteBuffer.wrap(data).getLong())
                   .max()
                   .orElse(0);
  }
  boolean ret = ((System.currentTimeMillis() - mostRecentTimestamp) < timeoutMs);
  LOG.debug("topology backpressure is {}", ret ? "on" : "off");
  return ret;
}
origin: org.apache.storm/storm-core

public static String backpressurePath(String stormId, String node, Long port) {
  return backpressureStormRoot(stormId) + ZK_SEPERATOR + node + "-" + port;
}
origin: org.apache.storm/storm-core

@Override
public void removeBackpressure(String stormId) {
  try {
    stateStorage.delete_node(ClusterUtils.backpressureStormRoot(stormId));
  } catch (Exception e) {
    if (Utils.exceptionCauseIsInstanceOf(KeeperException.class, e)) {
      // do nothing
      LOG.warn("Could not teardown backpressure node for {}.", stormId);
    } else {
      throw e;
    }
  }
}
origin: org.apache.storm/storm-core

/**
 * Check whether a topology is in throttle-on status or not:
 * if the backpresure/storm-id dir is not empty, this topology has throttle-on, otherwise throttle-off.
 * 
 * @param stormId
 * @param callback
 * @return
 */
@Override
public boolean topologyBackpressure(String stormId, Runnable callback) {
  if (callback != null) {
    backPressureCallback.put(stormId, callback);
  }
  String path = ClusterUtils.backpressureStormRoot(stormId);
  List<String> childrens = null;
  if(stateStorage.node_exists(path, false)) {
    childrens = stateStorage.get_children(path, callback != null);
  } else {
    childrens = new ArrayList<>();
  }
  return childrens.size() > 0;
}
origin: org.apache.storm/storm-core

@Override
public void setupBackpressure(String stormId, Map<String, Object> topoConf) {
  stateStorage.mkdirs(ClusterUtils.BACKPRESSURE_SUBTREE, acls);
  stateStorage.mkdirs(ClusterUtils.backpressureStormRoot(stormId), ClusterUtils.mkTopoReadWriteAcls(topoConf));
}
org.apache.storm.clusterClusterUtilsbackpressureStormRoot

Popular methods of ClusterUtils

  • mkStormClusterState
  • errorStormRoot
  • assignmentPath
  • backpressurePath
  • blobstoreMaxKeySequenceNumberPath
  • blobstorePath
  • convertExecutorBeats
    Ensures that we only return heartbeats for executors assigned to this worker
  • credentialsPath
  • errorPath
  • lastErrorPath
  • logConfigPath
  • maybeDeserialize
  • logConfigPath,
  • maybeDeserialize,
  • mkStateStorage,
  • mkStateStorageImpl,
  • mkStormClusterStateImpl,
  • mkTopoAcls,
  • mkTopoReadOnlyAcls,
  • mkTopoReadWriteAcls,
  • nimbusPath

Popular in Java

  • Finding current android device location
  • compareTo (BigDecimal)
  • setScale (BigDecimal)
  • findViewById (Activity)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Permission (java.security)
    Legacy security code; do not use.
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now