package util
- Alphabetic
- By Inheritance
- util
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- class AsyncLatch extends AnyRef
A construct providing latched, asynchronous execution of side-effecting functions.
A construct providing latched, asynchronous execution of side-effecting functions. com.twitter.finagle.util.AsyncLatch#await does not block, but the execution of functions passed to it may be delayed. That is, because the latch guarantees serial, non-concurrent execution, functions passed to
await
may have to wait until both of the following conditions are met:1. No other functions are being executed 2. The latch's count is zero
Thus, calling com.twitter.finagle.util.AsyncLatch#incr will cause subsequent functions passed to com.twitter.finagle.util.AsyncLatch#await to be delayed until the count is decremented to zero. Once the count is zero, functions are executed in LIFO order, i.e., the reverse of the order in which they are given to
await
. - trait Chan[-T] extends AnyRef
- trait CloseNotifier extends AnyRef
Allows resources to register their handlers to be invoked when service is closing.
- trait Drv extends (Rng) => Int
- trait Proc[-T] extends Chan[T]
A Proc is a process that can receive messages.
A Proc is a process that can receive messages. Procs guarantee that exactly one message is delivered at a time, and that they are delivered in the order received.
They can be thought of as featherweight actors.
- trait ReporterFactory extends (String, Option[SocketAddress]) => Monitor
- trait Rng extends AnyRef
A random number generator.
A random number generator. Java's divergent interfaces forces our hand here: ThreadLocalRandom does not conform to java.util.Random. We bridge this gap.
- trait Showable[-T] extends AnyRef
Trait showable is a type-class for showing parseable representations of objects.
- trait StackRegistry extends AnyRef
A registry that allows the registration of a string identifier with a a com.twitter.finagle.Stack and its params.
A registry that allows the registration of a string identifier with a a com.twitter.finagle.Stack and its params. This is especially useful in keeping a process global registry of Finagle clients and servers for dynamic introspection.
- class WindowedPercentileHistogram extends Closable
Sliding window of
numBuckets
histograms.Sliding window of
numBuckets
histograms. Each bucket covers abucketSize
interval and must be full before being counted inpercentile
.
Value Members
- val DefaultLogger: Logger
- object ByteArrays
- object CloseNotifier
- object DefaultTimer extends ProxyTimer
Finagle's default Timer that's intended to be shared across a number of servers/clients.
Finagle's default Timer that's intended to be shared across a number of servers/clients.
The default Timer is intended for scheduling tasks that will finish very quickly and shouldn't be used to schedule tasks that will occupy the executing thread for a significant duration.
Use
DefaultTimer.Implicit
to import an implicit instance of this timer into the scope.scala> import com.twitter.util.Future, com.twitter.conversions.DurationOps._ scala> import com.twitter.finagle.util.DefaultTimer.Implicit scala> val f = Future.sleep(10.seconds) f: com.twitter.util.Future[Unit] = <function0>
Java users may prefer
DefaultTimer.getInstance()
to access this timer.- Note
This timer is "unstoppable" such that calls to
stop()
is ignored.
- object Drv
Create discrete random variables representing arbitrary distributions.
- object ExitGuard
ExitGuard prevents the process from exiting normally by use of a nondaemon thread whenever there is at least one guarder.
- object InetSocketAddressUtil
- object LoadService
Load a singleton class in the manner of java.util.ServiceLoader.
Load a singleton class in the manner of java.util.ServiceLoader. It is more resilient to varying Java packaging configurations than ServiceLoader.
- See also
com.twitter.app.LoadService
in util-app
- object LoadedReporterFactory extends ReporterFactory
- object NullReporterFactory extends ReporterFactory
- object Proc
- object Rng
See Rngs for Java compatible APIs.
- object Rngs
Java compatible forwarders.
- object Showable
- object StackRegistry
- object WindowedPercentileHistogram
- object defaultTimerProbeSlowTasks extends GlobalFlag[Boolean]
Configures whether to probe for slow tasks executing in the default
Timer
.Configures whether to probe for slow tasks executing in the default
Timer
.When enabled, tasks are monitored to detect tasks that are slow to complete. A counter of the number of slow tasks is registered at
finagle/timer/slow
. Additionally, if a slow task is observed executing the stack traces of all threads will be logged at level WARN. The maximum runtime and minimum interval between logging stack traces can be tuned using the global flagsc.t.f.u.defaultTimerSlowTaskMaxRuntime
andc.t.f.u.defaultTimerSlowTaskLogMinInterval
, defined below.- Note
Observation of a slow task in progress is performed when scheduling additional work and is thus susceptible to false negatives.
- object defaultTimerSlowTaskLogMinInterval extends GlobalFlag[Duration]
Configures the minimum duration between logging stack traces when a slow task is detected in the default
Timer
. - object defaultTimerSlowTaskMaxRuntime extends GlobalFlag[Duration]
Configures the maximum allowed runtime for tasks executing in the default
Timer
.