Class OneTimeConsumerRunnable<T>

  • All Implemented Interfaces:
    Cancellable, CancellableConsumerRunnable<T>, java.util.function.Consumer<T>

    public class OneTimeConsumerRunnable<T>
    extends AwtValueRunnable<T>
    implements CancellableConsumerRunnable<T>
    Used to create a task that can be run at most once and the run can be cancelled before it has run, in which case further attempts to run it will do nothing.

    Can also specify that it should run on the AWT thread, otherwise it will run on the application thread

    Useful for triggering actions after a delay that may need to be run before the delay triggers

    • Constructor Detail

      • OneTimeConsumerRunnable

        public OneTimeConsumerRunnable​(@NotNull
                                       @NotNull java.util.function.Consumer<T> command)
      • OneTimeConsumerRunnable

        public OneTimeConsumerRunnable​(@NotNull
                                       @NotNull java.lang.String id,
                                       @NotNull
                                       @NotNull java.util.function.Consumer<T> command)
      • OneTimeConsumerRunnable

        public OneTimeConsumerRunnable​(@NotNull
                                       @NotNull java.lang.String id,
                                       boolean awtThread,
                                       java.util.function.Consumer<T> command)