类 Once


  • public class Once
    extends java.lang.Object
    Run 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)

    • 方法概要

      所有方法 静态方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      static Once create()
      Create new Once instance
      boolean run​(java.lang.Runnable runnable)
      Run a runnable, only when this method of the instance is called first time.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 方法详细资料

      • 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.