Interface Runner

All Superinterfaces:
Runnable
All Known Subinterfaces:
CacheEntryMutator
All Known Implementing Classes:
AbstractCacheEntryMutator, EmbeddedCacheEntryComputer, EmbeddedCacheEntryMutator, RemoteCacheEntryComputer, RemoteCacheEntryMutator

public interface Runner extends Runnable
An enhanced runnable.
Author:
Paul Ferraro
  • Field Details

    • EMPTY

      static final Runner EMPTY
      A runner that performs no action.
  • Method Details

    • andThen

      default Runner andThen(Runnable after)
      Returns a runner that runs the specified runner after running this runner.
      Parameters:
      after - a runner to run after this runner
      Returns:
      a runner that runs the specified runner after running this runner.
    • compose

      default Runner compose(Runnable before)
      Returns a runner that runs the specified runner before running this runner.
      Parameters:
      before - a runner to run before this runner
      Returns:
      a runner that runs the specified runner before running this runner.
    • handle

      default Runner handle(Consumer<RuntimeException> handler)
      Returns a new runnable that delegates to the specified handler in the event of an exception.
      Parameters:
      handler - a runtime exception handler
      Returns:
      a new runnable that delegates to the specified handler in the event of an exception.
    • empty

      static Runner empty()
      Returns an empty runner.
      Returns:
      an empty runner.
    • throwing

      static Runner throwing(Supplier<RuntimeException> exceptionProvider)
      Returns a runner that throws the provided runtime exception.
      Parameters:
      exceptionProvider - a runtime exception provider
      Returns:
      a runner that throws the provided runtime exception.
    • accept

      static <T> Runner accept(Consumer<? super T> consumer, Supplier<? extends T> supplier)
      Returns a runner that consumes a value from the specified supplier.
      Type Parameters:
      T - the consumed value
      Parameters:
      consumer - a consumer of the supplied value
      supplier - a supplier of the consumed value
      Returns:
      a runner that consumes a value from the specified supplier.
    • accept

      static Runner accept(DoubleConsumer consumer, DoubleSupplier supplier)
      Returns a runner that consumes a value from the specified supplier.
      Parameters:
      consumer - a consumer of the supplied value
      supplier - a supplier of the consumed value
      Returns:
      a runner that consumes a value from the specified supplier.
    • accept

      static Runner accept(IntConsumer consumer, IntSupplier supplier)
      Returns a runner that consumes a value from the specified supplier.
      Parameters:
      consumer - a consumer of the supplied value
      supplier - a supplier of the consumed value
      Returns:
      a runner that consumes a value from the specified supplier.
    • accept

      static Runner accept(LongConsumer consumer, LongSupplier supplier)
      Returns a runner that consumes a value from the specified supplier.
      Parameters:
      consumer - a consumer of the supplied value
      supplier - a supplier of the consumed value
      Returns:
      a runner that consumes a value from the specified supplier.
    • runAll

      static Runner runAll(Iterable<? extends Runnable> runners)
      Returns a composite runner that runs the specified runners.
      Parameters:
      runners - zero or more runners
      Returns:
      a composite runner that runs the specified runners, logging any exceptions