object AsyncMeter
- Alphabetic
- By Inheritance
- AsyncMeter
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def extraWideAwait(permits: Int, meter: AsyncMeter): Future[Unit]
Allows the user to
await
on requests that have a wider width than theburstSize
specified in AsyncMeter.Allows the user to
await
on requests that have a wider width than theburstSize
specified in AsyncMeter.WARNING: this means that you are able to arbitrarily exceed your
burstSize
setting, so it violates the contract that you never exceedburstSize
within a givenburstDuration
. Also, because of the implementation, it consumes more than one slot frommaxWaiters
. - def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def newMeter(burstSize: Int, burstDuration: Duration, maxWaiters: Int)(implicit timer: Timer): AsyncMeter
Creates an AsyncMeter that has a maximum burst size of
burstSize
overburstDuration
, and no more thanmaxWaiters
waiters.Creates an AsyncMeter that has a maximum burst size of
burstSize
overburstDuration
, and no more thanmaxWaiters
waiters. TheburstSize
permits will be disbursed on a regular schedule, so that they aren't bunched up. - def newUnboundedMeter(burstSize: Int, burstDuration: Duration)(implicit timer: Timer): AsyncMeter
Creates an AsyncMeter that has a maximum burst size of
burstSize
overburstDuration
, and an unbounded number of waiters.Creates an AsyncMeter that has a maximum burst size of
burstSize
overburstDuration
, and an unbounded number of waiters. TheburstSize
permits will be disbursed on a regular schedule, so that they aren't bunched up.WARNING: Only use an unbounded number of waiters when some other aspect of your implementation already bounds the number of waiters. If there is no other bound, the waiters can use up your process' resources.
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def perSecond(permits: Int, maxWaiters: Int)(implicit timer: Timer): AsyncMeter
Creates an AsyncMeter that allows smoothed out
permits
per second, and has a maximum burst size ofpermits
over one second.Creates an AsyncMeter that allows smoothed out
permits
per second, and has a maximum burst size ofpermits
over one second.This is equivalent to
AsyncMeter.newMeter(permits, 1.second, maxWaiters)
.- See also
perSecondUnbounded for creating an async meter that allows unbounded waiters
- def perSecondLimited(permits: Int, maxWaiters: Int)(implicit timer: Timer): AsyncMeter
Creates an AsyncMeter that allows smoothed out
permits
per second, and has a maximum burst size of 1 permit over1.second / permits
.Creates an AsyncMeter that allows smoothed out
permits
per second, and has a maximum burst size of 1 permit over1.second / permits
.This method produces AsyncMeters that might be placed before an external API forcing a rate limit over a one second. For example, the following meter rate limits its callers to make sure no more than 8 QPS is sent at any point of time.
val meter = AsyncMeter.perSecondLimited(8, 100)
This is equivalent to
AsyncMeter.newMeter(1, 1.second / permits, maxWaiters)
. - def perSecondUnbounded(permits: Int)(implicit timer: Timer): AsyncMeter
Creates an AsyncMeter that allows smoothed out
permits
per second, and has a maximum burst size ofpermits
over one second.Creates an AsyncMeter that allows smoothed out
permits
per second, and has a maximum burst size ofpermits
over one second.This meter is not bounded by the number of allowed waiters. This is equivalent to
AsyncMeter.newUnboundedMeter(permits, 1.second, maxWaiters)
.- See also
perSecond for creating an async meter that only allows a certain number of waiters
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()