Instance Constructors
-
new
RequestPurgatory(brokerId: Int = 0, purgeInterval: Int = 1000)
Abstract Value Members
-
abstract
def
checkSatisfied(request: T): Boolean
-
abstract
def
expire(delayed: T): Unit
Concrete Value Members
-
final
def
!=(arg0: AnyRef): Boolean
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: AnyRef): Boolean
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
checkAndMaybeWatch(delayedRequest: T): Boolean
-
def
clone(): AnyRef
-
def
debug(msg: ⇒ String, e: ⇒ Throwable): Unit
-
def
debug(e: ⇒ Throwable): Any
-
def
debug(msg: ⇒ String): Unit
-
def
delayed(): Int
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
error(msg: ⇒ String, e: ⇒ Throwable): Unit
-
def
error(e: ⇒ Throwable): Any
-
def
error(msg: ⇒ String): Unit
-
def
fatal(msg: ⇒ String, e: ⇒ Throwable): Unit
-
def
fatal(e: ⇒ Throwable): Any
-
def
fatal(msg: ⇒ String): Unit
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
def
info(msg: ⇒ String, e: ⇒ Throwable): Unit
-
def
info(e: ⇒ Throwable): Any
-
def
info(msg: ⇒ String): Unit
-
final
def
isInstanceOf[T0]: Boolean
-
var
logIdent: String
-
lazy val
logger: Logger
-
val
loggerName: String
-
final
def
ne(arg0: AnyRef): Boolean
-
def
newGauge[T](name: String, metric: Gauge[T], tags: Map[String, String] = Map.empty): Gauge[T]
-
def
newHistogram(name: String, biased: Boolean = true, tags: Map[String, String] = Map.empty): Histogram
-
def
newMeter(name: String, eventType: String, timeUnit: TimeUnit, tags: Map[String, String] = Map.empty): Meter
-
def
newTimer(name: String, durationUnit: TimeUnit, rateUnit: TimeUnit, tags: Map[String, String] = Map.empty): Timer
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
def
removeMetric(name: String, tags: Map[String, String] = Map.empty): Unit
-
def
shutdown(): Unit
-
def
swallow(action: ⇒ Unit): Unit
-
def
swallowDebug(action: ⇒ Unit): Unit
-
def
swallowError(action: ⇒ Unit): Unit
-
def
swallowInfo(action: ⇒ Unit): Unit
-
def
swallowTrace(action: ⇒ Unit): Unit
-
def
swallowWarn(action: ⇒ Unit): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
def
trace(msg: ⇒ String, e: ⇒ Throwable): Unit
-
def
trace(e: ⇒ Throwable): Any
-
def
trace(msg: ⇒ String): Unit
-
def
update(key: Any): Seq[T]
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
-
def
warn(msg: ⇒ String, e: ⇒ Throwable): Unit
-
def
warn(e: ⇒ Throwable): Any
-
def
warn(msg: ⇒ String): Unit
-
def
watched(): Int
Inherited from AnyRef
Inherited from Any
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.