Codota Logo
State.equals
Code IndexAdd Codota to your IDE (free)

How to use
equals
method
in
com.yahoo.vdslib.state.State

Best Java code snippets using com.yahoo.vdslib.state.State.equals (Showing top 13 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: com.yahoo.vespa/vdslib

@Override
public boolean equals(Object o) {
  if (!(o instanceof DiskState)) { return false; }
  DiskState other = (DiskState) o;
  if (state.equals(other.state)
    && Math.abs(capacity - other.capacity) < 0.00000001)
  {
    return true;
  }
  return false;
}
origin: com.yahoo.vespa/vdslib

private boolean metaInformationSimilarTo(final ClusterState other) {
  if (version != other.version || !state.equals(other.state)) {
    return false;
  }
  if (distributionBits != other.distributionBits) {
    return false;
  }
  return nodeCount.equals(other.nodeCount);
}
origin: com.yahoo.vespa/vdslib

@Override
public boolean equals(Object o) {
  if (!(o instanceof ClusterState)) { return false; }
  ClusterState other = (ClusterState) o;
  if (version != other.version
    || !state.equals(other.state)
    || distributionBits != other.distributionBits
    || !nodeCount.equals(other.nodeCount)
    || !nodeStates.equals(other.nodeStates))
  {
    return false;
  }
  return true;
}
origin: com.yahoo.vespa/vdslib

private void updateAnyDiskDownFlag() {
  boolean anyDown = false;
  for (DiskState ds : diskStates) {
    if (!ds.getState().equals(State.UP)) {
      anyDown = true;
      break;
    }
  }
  anyDiskDown = anyDown;
}
origin: com.yahoo.vespa/vdslib

public String serialize(String prefix, boolean includeDescription) {
  boolean empty = true;
  StringBuilder sb = new StringBuilder();
  if (!state.equals(State.UP) || prefix.length() < 2) {
    sb.append(prefix).append("s:").append(state.serialize());
    empty = false;
  }
  if (Math.abs(capacity - 1.0) > 0.000000001) {
    if (empty) { empty = false; } else { sb.append(' '); }
    sb.append(prefix).append("c:").append(capacity);
  }
  if (includeDescription && description.length() > 0) {
    if (!empty) { sb.append(' '); }
    sb.append(prefix).append("m:").append(StringUtilities.escape(description, ' '));
  }
  return sb.toString();
}
origin: com.yahoo.vespa/vdslib

private boolean similarToImpl(final ClusterState other, final NodeStateCmp nodeStateCmp) {
  if (other == this) {
    return true; // We're definitely similar to ourselves.
  }
  // Two cluster states are considered similar if they are both down. When clusters
  // are down, their individual node states do not matter to ideal state computations
  // and content nodes therefore do not need to observe them.
  if (state.equals(State.DOWN) && other.state.equals(State.DOWN)) {
    return true;
  }
  if (!metaInformationSimilarTo(other)) {
    return false;
  }
  // TODO verify behavior of C++ impl against this
  for (Node node : unionNodeSetWith(other.nodeStates.keySet())) {
    final NodeState lhs = nodeStates.get(node);
    final NodeState rhs = other.nodeStates.get(node);
    if (!nodeStateCmp.similar(node.getType(), lhs, rhs)) {
      return false;
    }
  }
  return true;
}
origin: com.yahoo.vespa/vdslib

private void removeLastNodesDownWithoutReason() {
  for (NodeType nodeType : NodeType.values()) {
    for (int index = nodeCount.get(nodeType.ordinal()) - 1; index >= 0; --index) {
      Node node = new Node(nodeType, index);
      NodeState nodeState = nodeStates.get(node);
      if (nodeState == null) break; // Node not existing is up
      if ( ! nodeState.getState().equals(State.DOWN)) break; // Node not down can not be removed
      if (nodeState.hasDescription()) break; // Node have reason to be down. Don't remove node as we will forget reason
      nodeStates.remove(node);
      nodeCount.set(nodeType.ordinal(), node.getIndex());
    }
  }
}
origin: com.yahoo.vespa/vdslib

  sb.append(compact ? ", r " : ", reliability ").append(reliability);
if (state.equals(State.INITIALIZING)) {
  sb.append(compact ? ", i " : ", init progress ").append(compact ? String.format(Locale.ENGLISH, "%.3g", initProgress) : initProgress);
  if (type.equals(NodeType.STORAGE)) {
origin: com.yahoo.vespa/vdslib

if (!state.equals(State.UP)) {
  sb.append(" cluster:").append(state.serialize());
  while (distributorNodeCount > 0 && getNodeState(new Node(NodeType.DISTRIBUTOR, distributorNodeCount - 1)).getState().equals(State.DOWN)) --distributorNodeCount;
  while (storageNodeCount > 0 && getNodeState(new Node(NodeType.STORAGE, storageNodeCount - 1)).getState().equals(State.DOWN)) --storageNodeCount;
origin: com.yahoo.vespa/vdslib

public Diff getDiff(NodeState other) {
  Diff diff = new Diff();
  if (!state.equals(other.state)) {
    diff.add(new Diff.Entry("", state, other.state).bold());
    diff.add(new Diff.Entry("minUsedBits", minUsedBits, other.minUsedBits));
  if (Math.abs(initProgress - other.initProgress) > 0.000000001 && state.equals(State.INITIALIZING) && other.state.equals(State.INITIALIZING)) {
    diff.add(new Diff.Entry("initProgress", initProgress, other.initProgress));
origin: com.yahoo.vespa/documentapi

private void updateCachedRoutingStateFromWrongDistribution(MessageContext context, ClusterState newState) {
  if (cachedClusterState == null || newState.getVersion() >= cachedClusterState.getVersion()) {
    cachedClusterState = newState;
    if (newState.getClusterState().equals(State.UP)) {
      hostFetcher.updateValidTargets(newState);
    }
  } else if (newState.getVersion() + 2000000000 < cachedClusterState.getVersion()) {
    cachedClusterState = null;
  } else if (context.calculatedDistributor != null) {
    persistentFailureChecker.addFailure(context.calculatedDistributor);
  }
}
origin: com.yahoo.vespa/vdslib

/**
 * Set the node state of the given node.
 *
 * Automatically adjusts number of nodes of that given type if out of range of current nodes seen.
 */
public void setNodeState(Node node, NodeState newState) {
  newState.verifyValidInSystemState(node.getType());
  if (node.getIndex() >= nodeCount.get(node.getType().ordinal())) {
    for (int i= nodeCount.get(node.getType().ordinal()); i<node.getIndex(); ++i) {
      nodeStates.put(new Node(node.getType(), i), new NodeState(node.getType(), State.DOWN));
    }
    nodeCount.set(node.getType().ordinal(), node.getIndex() + 1);
  }
  if (newState.equals(new NodeState(node.getType(), State.UP))) {
    nodeStates.remove(node);
  } else {
    nodeStates.put(node, newState);
  }
  if (newState.getState().equals(State.DOWN)) {
    // We might be setting the last node down, so we can remove some states
    removeLastNodesDownWithoutReason();
  }
}
origin: com.yahoo.vespa/vdslib

public Diff getDiff(ClusterState other) {
  Diff diff = new Diff();
  if (version != other.version) {
    diff.add(new Diff.Entry("version", version, other.version));
  }
  if (!state.equals(other.state)) {
    diff.add(new Diff.Entry("cluster", state, other.state));
  }
  if (distributionBits != other.distributionBits) {
    diff.add(new Diff.Entry("bits", distributionBits, other.distributionBits));
  }
  if (official != other.official) {
    diff.add(new Diff.Entry("official", official, other.official));
  }
  for (NodeType type : NodeType.getTypes()) {
    Diff typeDiff = new Diff();
    int maxCount = Math.max(getNodeCount(type), other.getNodeCount(type));
    for (int i = 0; i < maxCount; i++) {
      Node n = new Node(type, i);
      Diff d = getNodeState(n).getDiff(other.getNodeState(n));
      if (d.differs()) {
        typeDiff.add(new Diff.Entry(i, d));
      }
    }
    if (typeDiff.differs()) {
      diff.add(new Diff.Entry(type, typeDiff).splitLine());
    }
  }
  return diff;
}
com.yahoo.vdslib.stateStateequals

Popular methods of State

  • oneOf
  • get
  • hashCode
  • name
  • ordinal
  • serialize
  • validClusterState
  • validCurrentNodeState
  • validDiskState
  • values

Popular in Java

  • Reading from database using SQL prepared statement
  • findViewById (Activity)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • onCreateOptionsMenu (Activity)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • DecimalFormat (java.text)
    DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
  • Set (java.util)
    A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1
  • BoxLayout (javax.swing)
  • JOptionPane (javax.swing)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
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