Class Once

java.lang.Object
io.javago.sync.Once

public class Once extends Object
The Once class implements Go's sync.Once. A utility class that ensures a given Runnable is executed only once.
  • Constructor Details

    • Once

      public Once()
      Constructs a new Once instance.
  • Method Details

    • doOnce

      public void doOnce(Runnable func)
      Executes the specified Runnable only once. If the Runnable has already been executed, subsequent calls will block until the first execution is complete.
      Parameters:
      func - the Runnable to be executed once