-
- All Implemented Interfaces:
-
app.rive.core.CheckableAutoCloseable,java.lang.AutoCloseable
public final class CloseOnce implements CheckableAutoCloseable
Utility to make CheckableAutoCloseable idempotent.
If everything required for disposal is available from the constructor, you can implement via delegation:
class Foo(...) : CheckableAutoCloseable by CloseOnce({ ... }). Otherwise, use as a member variable, e.g.:private val closer = CloseOnce { ... }, and forward close and closed to it.Thread-safe, performing a no-op after the first close.