All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.opentsdb.uid.FailedToAssignUniqueIdException Maven / Gradle / Ivy

Go to download

OpenTSDB is a distributed, scalable Time Series Database (TSDB) written on top of HBase. OpenTSDB was written to address a common need: store, index and serve metrics collected from computer systems (network gear, operating systems, applications) at a large scale, and make this data easily accessible and graphable.

There is a newer version: 2.4.1
Show newest version
package net.opentsdb.uid;

/**
 * Thrown when we failed to assign an ID to a string such as a metric, tagk
 * or tag v.
 * @see UniqueId
 */
public final class FailedToAssignUniqueIdException extends RuntimeException {
  /** The 'kind' of the table. */
  private final String kind;
  /** The name of the object attempting to be assigned */
  private final String name;
  /** How many attempts were made to assign the ID */
  private final int attempts;
  
  /**
   * CTor
   * @param kind The kind of object that couldn't be assigned
   * @param name The name of the object that couldn't be assigned
   * @param attempts How many attempts were made to assign
   */
  public FailedToAssignUniqueIdException(final String kind, final String name, 
      final int attempts) {
    super("Failed to assign random ID for kind='" + kind + "' name='" + 
      name + "' after " + attempts + " attempts");
    this.kind = kind;
    this.name = name;
    this.attempts = attempts;
  }

  /**
   * CTor
   * @param kind The kind of object that couldn't be assigned
   * @param name The name of the object that couldn't be assigned
   * @param attempts How many attempts were made to assign
   * @param msg A message to append
   * @since 2.3
   */
  public FailedToAssignUniqueIdException(final String kind, final String name, 
      final int attempts, final String msg) {
    super("Failed to assign ID for kind='" + kind + "' name='" + 
      name + "' after " + attempts + " attempts due to: " + msg);
    this.kind = kind;
    this.name = name;
    this.attempts = attempts;
  }
  
  /**
   * CTor
   * @param kind The kind of object that couldn't be assigned
   * @param name The name of the object that couldn't be assigned
   * @param attempts How many attempts were made to assign
   * @param ex An exception that caused assignment to fail
   */
  public FailedToAssignUniqueIdException(final String kind, final String name, 
      final int attempts, final Throwable ex) {
    super("Failed to assign random ID for kind='" + kind + "' name='" + 
      name + "' after " + attempts + " attempts", ex);
    this.kind = kind;
    this.name = name;
    this.attempts = attempts;
  }
  
  
  /** @return Returns the kind of unique ID that couldn't be assigned.  */
  public String kind() {
    return kind;
  }

  /** @return Returns the name of the object that couldn't be assigned */
  public String name() {
    return name;
  }
  
  /** @return Returns how many attempts were made to assign a UID */
  public int attempts() {
    return attempts;
  }
  
  private static final long serialVersionUID = 399163221436118367L;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy