Class ConnectableConsumer<T>

java.lang.Object
com.atlassian.confluence.util.ConnectableConsumer<T>
Type Parameters:
T - the type of the input
All Implemented Interfaces:
Consumer<T>

@ParametersAreNonnullByDefault public class ConnectableConsumer<T> extends Object implements Consumer<T>
A proxy Consumer that collects the items it accepts, then pass them through to a target Consumer when connected. In this way, you can start accepting items before the target Consumer is available.
Since:
7.11
  • Constructor Details

    • ConnectableConsumer

      public ConnectableConsumer()
  • Method Details

    • connect

      public void connect(Consumer<T> consumer)
      Process all buffered items, and send all future items to the target Consumer
      Parameters:
      consumer -
    • accept

      public void accept(T t)
      Specified by:
      accept in interface Consumer<T>