|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.linkedin.util.concurrent.ConcurrentUtils
org.linkedin.groovy.util.concurrent.GroovyConcurrentUtils
class GroovyConcurrentUtils extends ConcurrentUtils
Method Summary | |
---|---|
static java.lang.Object
|
awaitFor(java.lang.Object clock, java.lang.Object timeout, java.lang.Object lock, groovy.lang.Closure closure)
The closure is the condition to wait on: it should return |
static void
|
waitForCondition(java.lang.Object clock, java.lang.Object timeout, java.lang.Object heartbeat, groovy.lang.Closure condition)
This call will wait until the condition as provided by the closure is |
static java.lang.Object
|
waitForShutdownMultiple(java.lang.Object clock, java.lang.Object timeout, java.util.Collection shutdownables)
Handle the logic when you need to wait for shutdown with a timeout on multiple shutdownable... |
static java.lang.Object
|
waitMultiple(java.lang.Object clock, java.lang.Object timeout, java.lang.Object closures)
When multiple waits need to happen with a timeout the logic is a little bit complicated because the timeout applies as a whole, not as individual waits. |
Method Detail |
---|
static java.lang.Object awaitFor(java.lang.Object clock, java.lang.Object timeout, java.lang.Object lock, groovy.lang.Closure closure)
false
until
the condition is met. When met, it should return true
.
lock
- the lock to wait on. Note that the method will do a synchronized on it, so you
don't have to...timeout
- can be null
if you want to wait forever, otherwise
you can provide a Timespan
, a String
(which has a format recognized
by Timespan
) or a number of milliseconds.
static void waitForCondition(java.lang.Object clock, java.lang.Object timeout, java.lang.Object heartbeat, groovy.lang.Closure condition)
true
.
Waits no longer than the timeout provided. Note that it is going to sleep as it is not a
wait/notify pattern. The sleeping time will increase between each calls to the closure.
Passing null
for the timeout will block until the condition is true
.
heartbeat
- how long to sleep between each closure call
static java.lang.Object waitForShutdownMultiple(java.lang.Object clock, java.lang.Object timeout, java.util.Collection shutdownables)
static java.lang.Object waitMultiple(java.lang.Object clock, java.lang.Object timeout, java.lang.Object closures)
timeout
- can be null
if you want to wait forever, otherwise
you can provide a Timespan
, a String
(which has a format recognized
by Timespan
) or a number of milliseconds.
Groovy Documentation