kafka.server

RequestPurgatory

abstract class RequestPurgatory[T <: DelayedRequest] extends Logging with KafkaMetricsGroup

A helper class for dealing with asynchronous requests with a timeout. A DelayedRequest has a request to delay and also a list of keys that can trigger the action. Implementations can add customized logic to control what it means for a given request to be satisfied. For example it could be that we are waiting for user-specified number of acks on a given (topic, partition) to be able to respond to a request or it could be that we are waiting for a given number of bytes to accumulate on a given request to be able to respond to that request (in the simple case we might wait for at least one byte to avoid busy waiting).

For us the key is generally a (topic, partition) pair. By calling val isSatisfiedByMe = checkAndMaybeWatch(delayedRequest) we will check if a request is satisfied already, and if not add the request for watch on all its keys.

It is up to the user to then call val satisfied = update(key, request) when a request relevant to the given key occurs. This triggers bookeeping logic and returns back any requests satisfied by this new request.

An implementation provides extends two helper functions def checkSatisfied(request: R, delayed: T): Boolean this function returns true if the given request (in combination with whatever previous requests have happened) satisfies the delayed request delayed. This method will likely also need to do whatever bookkeeping is necessary.

The second function is def expire(delayed: T) this function handles delayed requests that have hit their time limit without being satisfied.

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. RequestPurgatory
  2. KafkaMetricsGroup
  3. Logging
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new RequestPurgatory(brokerId: Int = 0, purgeInterval: Int = 1000)

Abstract Value Members

  1. abstract def checkSatisfied(request: T): Boolean

    Check if this delayed request is already satisfied

    Check if this delayed request is already satisfied

    Attributes
    protected
  2. abstract def expire(delayed: T): Unit

    Handle an expired delayed request

    Handle an expired delayed request

    Attributes
    protected

Concrete Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def checkAndMaybeWatch(delayedRequest: T): Boolean

    Try to add the request for watch on all keys.

    Try to add the request for watch on all keys. Return true iff the request is satisfied and the satisfaction is done by the caller.

  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def debug(msg: ⇒ String, e: ⇒ Throwable): Unit

    Definition Classes
    Logging
  10. def debug(e: ⇒ Throwable): Any

    Definition Classes
    Logging
  11. def debug(msg: ⇒ String): Unit

    Definition Classes
    Logging
  12. def delayed(): Int

  13. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  15. def error(msg: ⇒ String, e: ⇒ Throwable): Unit

    Definition Classes
    Logging
  16. def error(e: ⇒ Throwable): Any

    Definition Classes
    Logging
  17. def error(msg: ⇒ String): Unit

    Definition Classes
    Logging
  18. def fatal(msg: ⇒ String, e: ⇒ Throwable): Unit

    Definition Classes
    Logging
  19. def fatal(e: ⇒ Throwable): Any

    Definition Classes
    Logging
  20. def fatal(msg: ⇒ String): Unit

    Definition Classes
    Logging
  21. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  22. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  23. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  24. def info(msg: ⇒ String, e: ⇒ Throwable): Unit

    Definition Classes
    Logging
  25. def info(e: ⇒ Throwable): Any

    Definition Classes
    Logging
  26. def info(msg: ⇒ String): Unit

    Definition Classes
    Logging
  27. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  28. var logIdent: String

    Attributes
    protected
    Definition Classes
    Logging
  29. lazy val logger: Logger

    Definition Classes
    Logging
  30. val loggerName: String

    Definition Classes
    Logging
  31. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  32. def newGauge[T](name: String, metric: Gauge[T], tags: Map[String, String] = Map.empty): Gauge[T]

    Definition Classes
    KafkaMetricsGroup
  33. def newHistogram(name: String, biased: Boolean = true, tags: Map[String, String] = Map.empty): Histogram

    Definition Classes
    KafkaMetricsGroup
  34. def newMeter(name: String, eventType: String, timeUnit: TimeUnit, tags: Map[String, String] = Map.empty): Meter

    Definition Classes
    KafkaMetricsGroup
  35. def newTimer(name: String, durationUnit: TimeUnit, rateUnit: TimeUnit, tags: Map[String, String] = Map.empty): Timer

    Definition Classes
    KafkaMetricsGroup
  36. final def notify(): Unit

    Definition Classes
    AnyRef
  37. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  38. def removeMetric(name: String, tags: Map[String, String] = Map.empty): Unit

    Definition Classes
    KafkaMetricsGroup
  39. def shutdown(): Unit

    Shutdown the expire reaper thread

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

    Definition Classes
    Logging
  41. def swallowDebug(action: ⇒ Unit): Unit

    Definition Classes
    Logging
  42. def swallowError(action: ⇒ Unit): Unit

    Definition Classes
    Logging
  43. def swallowInfo(action: ⇒ Unit): Unit

    Definition Classes
    Logging
  44. def swallowTrace(action: ⇒ Unit): Unit

    Definition Classes
    Logging
  45. def swallowWarn(action: ⇒ Unit): Unit

    Definition Classes
    Logging
  46. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  47. def toString(): String

    Definition Classes
    AnyRef → Any
  48. def trace(msg: ⇒ String, e: ⇒ Throwable): Unit

    Definition Classes
    Logging
  49. def trace(e: ⇒ Throwable): Any

    Definition Classes
    Logging
  50. def trace(msg: ⇒ String): Unit

    Definition Classes
    Logging
  51. def update(key: Any): Seq[T]

    Update any watchers and return a list of newly satisfied requests.

  52. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  53. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  54. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  55. def warn(msg: ⇒ String, e: ⇒ Throwable): Unit

    Definition Classes
    Logging
  56. def warn(e: ⇒ Throwable): Any

    Definition Classes
    Logging
  57. def warn(msg: ⇒ String): Unit

    Definition Classes
    Logging
  58. def watched(): Int

Inherited from KafkaMetricsGroup

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped