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
.
Allows resources to register their handlers to be invoked when service is closing.
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.
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 is a type-class for showing parseable representations of objects.
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.
Sliding window of numBuckets
histograms.
Sliding window of numBuckets
histograms. Each bucket covers a bucketSize
interval and must
be full before being counted in percentile
.
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.
This timer is "unstoppable" such that calls to stop()
is ignored.
Create discrete random variables representing arbitrary distributions.
ExitGuard prevents the process from exiting normally by use of a nondaemon thread whenever there is at least one guarder.
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.
com.twitter.app.LoadService
in util-app
See Rngs for Java compatible APIs.
Java compatible forwarders.
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 flags c.t.f.u.defaultTimerSlowTaskMaxRuntime
and
c.t.f.u.defaultTimerSlowTaskLogMinInterval
, defined below.
Observation of a slow task in progress is performed when scheduling additional work and is thus susceptible to false negatives.
Configures the minimum duration between logging stack traces when a slow task is
detected in the default Timer
.
Configures the maximum allowed runtime for tasks executing in the default Timer
.