public class Once extends Object
CheckedRunnable only once.
Once the runOnce() method has been successfully executed, subsequent invocations to
such method will have no effect. Notice that the key word here is successfully. If the method fails,
each invocation to runOnce() WILL run the delegate until it completes successfully.
Instances are thread safe, which means that if two threads are competing for the first successful invocation, only one will prevail and the other one will get a no-op execution.
| Modifier and Type | Method and Description |
|---|---|
static Once |
of(CheckedRunnable runnable)
Creates a new instance
|
void |
runOnce()
Runs (or not) the delegate according to the behaviour described on the class javadoc
|
public static Once of(CheckedRunnable runnable)
runnable - the delegate to be executed only oncepublic void runOnce()
Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.