Codota Logo
ClusterUtils
Code IndexAdd Codota to your IDE (free)

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

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: apache/storm

private static IStormClusterState makeStormClusterState(Map<String, Object> conf) throws Exception {
  return ClusterUtils.mkStormClusterState(conf, new ClusterStateContext(DaemonType.NIMBUS, conf));
}
origin: apache/storm

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

@Override
public void removeStorm(String stormId) {
  stateStorage.delete_node(ClusterUtils.assignmentPath(stormId));
  this.assignmentsBackend.clearStateForStorm(stormId);
  stateStorage.delete_node(ClusterUtils.credentialsPath(stormId));
  stateStorage.delete_node(ClusterUtils.logConfigPath(stormId));
  stateStorage.delete_node(ClusterUtils.profilerConfigPath(stormId));
  removeStormBase(stormId);
}
origin: apache/storm

@Override
public Assignment remoteAssignmentInfo(String stormId, Runnable callback) {
  if (callback != null) {
    assignmentInfoCallback.put(stormId, callback);
  }
  byte[] serialized = stateStorage.get_data(ClusterUtils.assignmentPath(stormId), callback != null);
  return ClusterUtils.maybeDeserialize(serialized, Assignment.class);
}
origin: apache/storm

@Override
public Credentials credentials(String stormId, Runnable callback) {
  if (callback != null) {
    credentialsCallback.put(stormId, callback);
  }
  String path = ClusterUtils.credentialsPath(stormId);
  return ClusterUtils.maybeDeserialize(stateStorage.get_data(path, callback != null), Credentials.class);
}
origin: apache/storm

@Override
public void setCredentials(String stormId, Credentials creds, Map<String, Object> topoConf) {
  List<ACL> aclList = ClusterUtils.mkTopoReadOnlyAcls(topoConf);
  String path = ClusterUtils.credentialsPath(stormId);
  stateStorage.set_data(path, Utils.serialize(creds), aclList);
}
origin: apache/storm

@Override
public void reportError(String stormId, String componentId, String node, Long port, Throwable error) {
  String path = ClusterUtils.errorPath(stormId, componentId);
  String lastErrorPath = ClusterUtils.lastErrorPath(stormId, componentId);
  ErrorInfo errorInfo = new ErrorInfo(ClusterUtils.stringifyError(error), Time.currentTimeSecs());
  errorInfo.set_host(node);
  errorInfo.set_port(port.intValue());
origin: apache/storm

  ConfigUtils.overrideLoginConfigWithSystemProperty(ConfigUtils.readSupervisorStormConf(conf, topologyId));
ClusterStateContext csContext = new ClusterStateContext(DaemonType.WORKER, topologyConf);
IStateStorage stateStorage = ClusterUtils.mkStateStorage(conf, topologyConf, csContext);
IStormClusterState stormClusterState = ClusterUtils.mkStormClusterState(stateStorage, null, csContext);
origin: apache/storm

public static String errorPath(String stormId, String componentId) {
  try {
    return errorStormRoot(stormId) + ZK_SEPERATOR + URLEncoder.encode(componentId, "UTF-8");
  } catch (UnsupportedEncodingException e) {
    throw Utils.wrapInRuntime(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

@Override
public void setAssignment(String stormId, Assignment info, Map<String, Object> topoConf) {
  byte[] serAssignment = Utils.serialize(info);
  stateStorage.mkdirs(ClusterUtils.ASSIGNMENTS_SUBTREE, defaultAcls);
  stateStorage.set_data(ClusterUtils.assignmentPath(stormId), Utils.serialize(info), ClusterUtils.mkTopoReadOnlyAcls(topoConf));
  this.assignmentsBackend.keepOrUpdateAssignment(stormId, info);
}
origin: apache/storm

@Override
public List<ErrorInfo> errors(String stormId, String componentId) {
  List<ErrorInfo> errorInfos = new ArrayList<>();
  String path = ClusterUtils.errorPath(stormId, componentId);
  if (stateStorage.node_exists(path, false)) {
    List<String> childrens = stateStorage.get_children(path, false);
    for (String child : childrens) {
      String childPath = path + ClusterUtils.ZK_SEPERATOR + child;
      ErrorInfo errorInfo = ClusterUtils.maybeDeserialize(stateStorage.get_data(childPath, false), ErrorInfo.class);
      if (errorInfo != null) {
        errorInfos.add(errorInfo);
      }
    }
  }
  Collections.sort(errorInfos, new Comparator<ErrorInfo>() {
    public int compare(ErrorInfo arg0, ErrorInfo arg1) {
      return Integer.compare(arg1.get_error_time_secs(), arg0.get_error_time_secs());
    }
  });
  return errorInfos;
}
origin: apache/storm

  String path = ClusterUtils.errorStormRoot(topoId);
  if (zk.checkExists().forPath(path) == null) {
    LOG.warn("Creating missing errors location {}", path);
verifyAclStrictRecursive(zk, superAcl, ClusterUtils.secretKeysPath(WorkerTokenServiceType.NIMBUS), fixUp);
verifyAclStrictRecursive(zk, drpcFullAcl, ClusterUtils.secretKeysPath(WorkerTokenServiceType.DRPC), fixUp);
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: apache/storm

@Override
public void removeBlobstoreKey(String blobKey) {
  LOG.debug("remove key {}", blobKey);
  stateStorage.delete_node(ClusterUtils.blobstorePath(blobKey));
}
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

@Override
public Integer assignmentVersion(String stormId, Runnable callback) throws Exception {
  if (callback != null) {
    assignmentVersionCallback.put(stormId, callback);
  }
  return stateStorage.get_version(ClusterUtils.assignmentPath(stormId), callback != null);
}
origin: apache/storm

@Override
public void removeWorkerBackpressure(String stormId, String node, Long port) {
  String path = ClusterUtils.backpressurePath(stormId, node, port);
  boolean existed = stateStorage.node_exists(path, false);
  if (existed) {
    stateStorage.delete_node(path);
  }
}
origin: apache/storm

@Override
public void removeKeyVersion(String blobKey) {
  stateStorage.delete_node(ClusterUtils.blobstoreMaxKeySequenceNumberPath(blobKey));
}
origin: apache/storm

public static String lastErrorPath(String stormId, String componentId) {
  return errorPath(stormId, componentId) + "-last-error";
}
org.apache.storm.clusterClusterUtils

Most used methods

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

Popular in Java

  • Creating JSON documents from java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setRequestProperty (URLConnection)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now