kafka.utils

ZkUtils

object ZkUtils extends Logging

Inherited
  1. Hide All
  2. Show all
  1. Logging
  2. AnyRef
  3. Any
Visibility
  1. Public
  2. All

Value Members

  1. def !=(arg0: AnyRef): Boolean

    attributes: final
    definition classes: AnyRef
  2. def !=(arg0: Any): Boolean

    o != arg0 is the same as !(o == (arg0)).

    o != arg0 is the same as !(o == (arg0)).

    arg0

    the object to compare against this object for dis-equality.

    returns

    false if the receiver object is equivalent to the argument; true otherwise.

    attributes: final
    definition classes: Any
  3. def ##(): Int

    attributes: final
    definition classes: AnyRef → Any
  4. def $asInstanceOf[T0](): T0

    attributes: final
    definition classes: AnyRef
  5. def $isInstanceOf[T0](): Boolean

    attributes: final
    definition classes: AnyRef
  6. def ==(arg0: AnyRef): Boolean

    o == arg0 is the same as if (o eq null) arg0 eq null else o.equals(arg0).

    o == arg0 is the same as if (o eq null) arg0 eq null else o.equals(arg0).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    attributes: final
    definition classes: AnyRef
  7. def ==(arg0: Any): Boolean

    o == arg0 is the same as o.equals(arg0).

    o == arg0 is the same as o.equals(arg0).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    attributes: final
    definition classes: Any
  8. val BrokerIdsPath: String

  9. val BrokerTopicsPath: String

  10. val ConsumersPath: String

  11. val ControllerEpochPath: String

  12. val ControllerPath: String

  13. val DeleteTopicsPath: String

  14. val PreferredReplicaLeaderElectionPath: String

  15. val ReassignPartitionsPath: String

  16. val TopicConfigChangesPath: String

  17. val TopicConfigPath: String

  18. def asInstanceOf[T0]: T0

    This method is used to cast the receiver object to be of type T0.

    This method is used to cast the receiver object to be of type T0.

    Note that the success of a cast at runtime is modulo Scala's erasure semantics. Therefore the expression1.asInstanceOf[String] will throw a ClassCastException at runtime, while the expressionList(1).asInstanceOf[List[String]] will not. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the requested typed.

    returns

    the receiver object.

    attributes: final
    definition classes: Any
  19. def clone(): AnyRef

    This method creates and returns a copy of the receiver object.

    This method creates and returns a copy of the receiver object.

    The default implementation of the clone method is platform dependent.

    returns

    a copy of the receiver object.

    attributes: protected
    definition classes: AnyRef
  20. def conditionalUpdatePersistentPath(client: ZkClient, path: String, data: String, expectVersion: Int): (Boolean, Int)

    Conditional update the persistent path data, return (true, newVersion) if it succeeds, otherwise (the path doesn't exist, the current version is not the expected version, etc.

    Conditional update the persistent path data, return (true, newVersion) if it succeeds, otherwise (the path doesn't exist, the current version is not the expected version, etc.) return (false, -1)

  21. def conditionalUpdatePersistentPathIfExists(client: ZkClient, path: String, data: String, expectVersion: Int): (Boolean, Int)

    Conditional update the persistent path data, return (true, newVersion) if it succeeds, otherwise (the current version is not the expected version, etc.

    Conditional update the persistent path data, return (true, newVersion) if it succeeds, otherwise (the current version is not the expected version, etc.) return (false, -1). If path doesn't exist, throws ZkNoNodeException

  22. def createEphemeralPathExpectConflict(client: ZkClient, path: String, data: String): Unit

    Create an ephemeral node with the given path and data.

    Create an ephemeral node with the given path and data. Throw NodeExistException if node already exists.

  23. def createEphemeralPathExpectConflictHandleZKBug(zkClient: ZkClient, path: String, data: String, expectedCallerData: Any, checker: (String, Any) ⇒ Boolean, backoffTime: Int): Unit

    Create an ephemeral node with the given path and data.

    Create an ephemeral node with the given path and data. Throw NodeExistsException if node already exists. Handles the following ZK session timeout bug:

    https://issues.apache.org/jira/browse/ZOOKEEPER-1740

    Upon receiving a NodeExistsException, read the data from the conflicted path and trigger the checker function comparing the read data and the expected data, If the checker function returns true then the above bug might be encountered, back off and retry; otherwise re-throw the exception

  24. def createPersistentPath(client: ZkClient, path: String, data: String = ""): Unit

    Create an persistent node with the given path and data.

    Create an persistent node with the given path and data. Create parents if necessary.

  25. def createSequentialPersistentPath(client: ZkClient, path: String, data: String = ""): String

  26. def debug(msg: ⇒ String, e: ⇒ Throwable): Unit

    definition classes: Logging
  27. def debug(e: ⇒ Throwable): Any

    definition classes: Logging
  28. def debug(msg: ⇒ String): Unit

    definition classes: Logging
  29. def deletePartition(zkClient: ZkClient, brokerId: Int, topic: String): Unit

  30. def deletePath(client: ZkClient, path: String): Boolean

  31. def deletePathRecursive(client: ZkClient, path: String): Unit

  32. def eq(arg0: AnyRef): Boolean

    This method is used to test whether the argument (arg0) is a reference to the receiver object (this).

    This method is used to test whether the argument (arg0) is a reference to the receiver object (this).

    The eq method implements an [http://en.wikipedia.org/wiki/Equivalence_relation equivalence relation] on non-null instances of AnyRef: * It is reflexive: for any non-null instance x of type AnyRef, x.eq(x) returns true. * It is symmetric: for any non-null instances x and y of type AnyRef, x.eq(y) returns true if and only if y.eq(x) returns true. * It is transitive: for any non-null instances x, y, and z of type AnyRef if x.eq(y) returns true and y.eq(z) returns true, then x.eq(z) returns true.

    Additionally, the eq method has three other properties. * It is consistent: for any non-null instances x and y of type AnyRef, multiple invocations of x.eq(y) consistently returns true or consistently returns false. * For any non-null instance x of type AnyRef, x.eq(null) and null.eq(x) returns false. * null.eq(null) returns true.

    When overriding the equals or hashCode methods, it is important to ensure that their behavior is consistent with reference equality. Therefore, if two objects are references to each other (o1 eq o2), they should be equal to each other (o1 == o2) and they should hash to the same value (o1.hashCode == o2.hashCode).

    arg0

    the object to compare against this object for reference equality.

    returns

    true if the argument is a reference to the receiver object; false otherwise.

    attributes: final
    definition classes: AnyRef
  33. def equals(arg0: Any): Boolean

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.

    The default implementations of this method is an [http://en.wikipedia.org/wiki/Equivalence_relation equivalence relation]: * It is reflexive: for any instance x of type Any, x.equals(x) should return true. * It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true. * It is transitive: for any instances x, y, and z of type AnyRef if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

    If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is often necessary to override hashCode to ensure that objects that are "equal" (o1.equals(o2) returns true) hash to the same scala.Int (o1.hashCode.equals(o2.hashCode)).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    definition classes: AnyRef → Any
  34. def error(msg: ⇒ String, e: ⇒ Throwable): Unit

    definition classes: Logging
  35. def error(e: ⇒ Throwable): Any

    definition classes: Logging
  36. def error(msg: ⇒ String): Unit

    definition classes: Logging
  37. def fatal(msg: ⇒ String, e: ⇒ Throwable): Unit

    definition classes: Logging
  38. def fatal(e: ⇒ Throwable): Any

    definition classes: Logging
  39. def fatal(msg: ⇒ String): Unit

    definition classes: Logging
  40. def finalize(): Unit

    This method is called by the garbage collector on the receiver object when garbage collection determines that there are no more references to the object.

    This method is called by the garbage collector on the receiver object when garbage collection determines that there are no more references to the object.

    The details of when and if the finalize method are invoked, as well as the interaction between finalizeand non-local returns and exceptions, are all platform dependent.

    attributes: protected
    definition classes: AnyRef
  41. def getAllBrokersInCluster(zkClient: ZkClient): Seq[Broker]

  42. def getAllPartitions(zkClient: ZkClient): Set[TopicAndPartition]

  43. def getAllTopics(zkClient: ZkClient): Seq[String]

  44. def getBrokerInfo(zkClient: ZkClient, brokerId: Int): Option[Broker]

    This API takes in a broker id, queries zookeeper for the broker metadata and returns the metadata for that broker or throws an exception if the broker dies before the query to zookeeper finishes

    This API takes in a broker id, queries zookeeper for the broker metadata and returns the metadata for that broker or throws an exception if the broker dies before the query to zookeeper finishes

    zkClient

    The zookeeper client connection

    brokerId

    The broker id

    returns

    An optional Broker object encapsulating the broker metadata

  45. def getChildren(client: ZkClient, path: String): Seq[String]

  46. def getChildrenParentMayNotExist(client: ZkClient, path: String): Seq[String]

  47. def getClass(): java.lang.Class[_]

    Returns a representation that corresponds to the dynamic class of the receiver object.

    Returns a representation that corresponds to the dynamic class of the receiver object.

    The nature of the representation is platform dependent.

    returns

    a representation that corresponds to the dynamic class of the receiver object.

    attributes: final
    definition classes: AnyRef
  48. def getCluster(zkClient: ZkClient): Cluster

  49. def getConsumerPartitionOwnerPath(group: String, topic: String, partition: Int): String

  50. def getConsumersInGroup(zkClient: ZkClient, group: String): Seq[String]

  51. def getConsumersPerTopic(zkClient: ZkClient, group: String): Map[String, List[String]]

  52. def getController(zkClient: ZkClient): Int

  53. def getDeleteTopicPath(topic: String): String

  54. def getEpochForPartition(zkClient: ZkClient, topic: String, partition: Int): Int

    This API should read the epoch in the ISR path.

    This API should read the epoch in the ISR path. It is sufficient to read the epoch in the ISR path, since if the leader fails after updating epoch in the leader path and before updating epoch in the ISR path, effectively some other broker will retry becoming leader with the same new epoch value.

  55. def getInSyncReplicasForPartition(zkClient: ZkClient, topic: String, partition: Int): Seq[Int]

    Gets the in-sync replicas (ISR) for a specific topic and partition

    Gets the in-sync replicas (ISR) for a specific topic and partition

  56. def getLeaderAndIsrForPartition(zkClient: ZkClient, topic: String, partition: Int): Option[LeaderAndIsr]

  57. def getLeaderForPartition(zkClient: ZkClient, topic: String, partition: Int): Option[Int]

  58. def getLeaderIsrAndEpochForPartition(zkClient: ZkClient, topic: String, partition: Int): Option[LeaderIsrAndControllerEpoch]

  59. def getPartitionAssignmentForTopics(zkClient: ZkClient, topics: Seq[String]): Map[String, Map[Int, Seq[Int]]]

  60. def getPartitionLeaderAndIsrForTopics(zkClient: ZkClient, topicAndPartitions: Set[TopicAndPartition]): Map[TopicAndPartition, LeaderIsrAndControllerEpoch]

  61. def getPartitionReassignmentZkData(partitionsToBeReassigned: Map[TopicAndPartition, Seq[Int]]): String

  62. def getPartitionsBeingReassigned(zkClient: ZkClient): Map[TopicAndPartition, ReassignedPartitionsContext]

  63. def getPartitionsForTopics(zkClient: ZkClient, topics: Seq[String]): Map[String, Seq[Int]]

  64. def getPartitionsUndergoingPreferredReplicaElection(zkClient: ZkClient): Set[TopicAndPartition]

  65. def getReplicaAssignmentForTopics(zkClient: ZkClient, topics: Seq[String]): Map[TopicAndPartition, Seq[Int]]

  66. def getReplicasForPartition(zkClient: ZkClient, topic: String, partition: Int): Seq[Int]

    Gets the assigned replicas (AR) for a specific topic and partition

    Gets the assigned replicas (AR) for a specific topic and partition

  67. def getSortedBrokerList(zkClient: ZkClient): Seq[Int]

  68. def getTopicConfigPath(topic: String): String

  69. def getTopicPartitionLeaderAndIsrPath(topic: String, partitionId: Int): String

  70. def getTopicPartitionPath(topic: String, partitionId: Int): String

  71. def getTopicPartitionsPath(topic: String): String

  72. def getTopicPath(topic: String): String

  73. def hashCode(): Int

    Returns a hash code value for the object.

    Returns a hash code value for the object.

    The default hashing algorithm is platform dependent.

    Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

    returns

    the hash code value for the object.

    definition classes: AnyRef → Any
  74. def info(msg: ⇒ String, e: ⇒ Throwable): Unit

    definition classes: Logging
  75. def info(e: ⇒ Throwable): Any

    definition classes: Logging
  76. def info(msg: ⇒ String): Unit

    definition classes: Logging
  77. def isInstanceOf[T0]: Boolean

    This method is used to test whether the dynamic type of the receiver object is T0.

    This method is used to test whether the dynamic type of the receiver object is T0.

    Note that the test result of the test is modulo Scala's erasure semantics. Therefore the expression1.isInstanceOf[String] will return false, while the expression List(1).isInstanceOf[List[String]] will return true. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the requested typed.

    returns

    true if the receiver object is an instance of erasure of type T0; false otherwise.

    attributes: final
    definition classes: Any
  78. def leaderAndIsrZkData(leaderAndIsr: LeaderAndIsr, controllerEpoch: Int): String

  79. var logIdent: String

    attributes: protected
    definition classes: Logging
  80. lazy val logger: Logger

    definition classes: Logging
  81. val loggerName: String

    definition classes: Logging
  82. def makeSurePersistentPathExists(client: ZkClient, path: String): Unit

    make sure a persistent path exists in ZK.

    make sure a persistent path exists in ZK. Create the path if not exist.

  83. def maybeDeletePath(zkUrl: String, dir: String): Unit

  84. def ne(arg0: AnyRef): Boolean

    o.ne(arg0) is the same as !(o.eq(arg0)).

    o.ne(arg0) is the same as !(o.eq(arg0)).

    arg0

    the object to compare against this object for reference dis-equality.

    returns

    false if the argument is not a reference to the receiver object; true otherwise.

    attributes: final
    definition classes: AnyRef
  85. def notify(): Unit

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Wakes up a single thread that is waiting on the receiver object's monitor.

    attributes: final
    definition classes: AnyRef
  86. def notifyAll(): Unit

    Wakes up all threads that are waiting on the receiver object's monitor.

    Wakes up all threads that are waiting on the receiver object's monitor.

    attributes: final
    definition classes: AnyRef
  87. def parseLeaderAndIsr(leaderAndIsrStr: String, topic: String, partition: Int, stat: Stat): Option[LeaderIsrAndControllerEpoch]

  88. def parsePartitionReassignmentData(jsonData: String): Map[TopicAndPartition, Seq[Int]]

  89. def parseTopicsData(jsonData: String): Seq[String]

  90. def pathExists(client: ZkClient, path: String): Boolean

    Check if the given path exists

    Check if the given path exists

  91. def readData(client: ZkClient, path: String): (String, Stat)

  92. def readDataMaybeNull(client: ZkClient, path: String): (Option[String], Stat)

  93. def registerBrokerInZk(zkClient: ZkClient, id: Int, host: String, port: Int, timeout: Int, jmxPort: Int): Unit

  94. def replicaAssignmentZkData(map: Map[String, Seq[Int]]): String

    Get JSON partition to replica map from zookeeper.

    Get JSON partition to replica map from zookeeper.

  95. def setupCommonPaths(zkClient: ZkClient): Unit

  96. def swallow(action: ⇒ Unit): Unit

    definition classes: Logging
  97. def swallowDebug(action: ⇒ Unit): Unit

    definition classes: Logging
  98. def swallowError(action: ⇒ Unit): Unit

    definition classes: Logging
  99. def swallowInfo(action: ⇒ Unit): Unit

    definition classes: Logging
  100. def swallowTrace(action: ⇒ Unit): Unit

    definition classes: Logging
  101. def swallowWarn(action: ⇒ Unit): Unit

    definition classes: Logging
  102. def synchronized[T0](arg0: T0): T0

    attributes: final
    definition classes: AnyRef
  103. def toString(): String

    Returns a string representation of the object.

    Returns a string representation of the object.

    The default representation is platform dependent.

    returns

    a string representation of the object.

    definition classes: AnyRef → Any
  104. def trace(msg: ⇒ String, e: ⇒ Throwable): Unit

    definition classes: Logging
  105. def trace(e: ⇒ Throwable): Any

    definition classes: Logging
  106. def trace(msg: ⇒ String): Unit

    definition classes: Logging
  107. def updateEphemeralPath(client: ZkClient, path: String, data: String): Unit

    Update the value of a persistent node with the given path and data.

    Update the value of a persistent node with the given path and data. create parrent directory if necessary. Never throw NodeExistException.

  108. def updatePartitionReassignmentData(zkClient: ZkClient, partitionsToBeReassigned: Map[TopicAndPartition, Seq[Int]]): Unit

  109. def updatePersistentPath(client: ZkClient, path: String, data: String): Unit

    Update the value of a persistent node with the given path and data.

    Update the value of a persistent node with the given path and data. create parrent directory if necessary. Never throw NodeExistException. Return the updated path zkVersion

  110. def wait(): Unit

    attributes: final
    definition classes: AnyRef
  111. def wait(arg0: Long, arg1: Int): Unit

    attributes: final
    definition classes: AnyRef
  112. def wait(arg0: Long): Unit

    attributes: final
    definition classes: AnyRef
  113. def warn(msg: ⇒ String, e: ⇒ Throwable): Unit

    definition classes: Logging
  114. def warn(e: ⇒ Throwable): Any

    definition classes: Logging
  115. def warn(msg: ⇒ String): Unit

    definition classes: Logging