Package io.javago.sync
Class Once
java.lang.Object
io.javago.sync.Once
The
Once class implements Go's sync.Once.
A utility class that ensures a given Runnable is executed only once.-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Once
public Once()Constructs a newOnceinstance.
-
-
Method Details
-
doOnce
Executes the specifiedRunnableonly once. If theRunnablehas already been executed, subsequent calls will block until the first execution is complete.- Parameters:
func- theRunnableto be executed once
-