类 Once
- java.lang.Object
-
- net.dongliu.commons.concurrent.Once
-
public class Once extends java.lang.ObjectRun block of code only once, even if runnable code throw exception. The following call to this will block until the first call finished, normally or exception thrown. This class is thread-safe.using
net.dongliu.commons.function.Runnables#runOnce(Runnable)
-
-
方法详细资料
-
create
public static Once create()
Create new Once instance
-
run
public boolean run(java.lang.Runnable runnable)
Run a runnable, only when this method of the instance is called first time.- 参数:
runnable- the code to be run- 返回:
- true if is call first time, and the runnable is run; false if not.
-
-