Class FireForgetProcessor<T>

java.lang.Object
com.helixframework.concurrency.processor.FireForgetProcessor<T>
Type Parameters:
T - event type
All Implemented Interfaces:
ShutdownBehaviorAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle

public abstract class FireForgetProcessor<T> extends Object implements org.springframework.context.SmartLifecycle, ShutdownBehaviorAware
Abstract processor that can be used to implement async fire and forget messaging.
  • Constructor Details

    • FireForgetProcessor

      public FireForgetProcessor()
      Creates a new instance of FireForgetProcessor.
    • FireForgetProcessor

      public FireForgetProcessor(int capacity)
      Creates a new instance of FireForgetProcessor.
      Parameters:
      capacity - capacity of processor before events are dropped
    • FireForgetProcessor

      public FireForgetProcessor(int capacity, Duration timeout)
      Creates a new instance of FireForgetProcessor.
      Parameters:
      capacity - capacity of processor before events are dropped
      timeout - timeout on event submit before event is dropped
  • Method Details

    • submit

      protected void submit(T input)
      Submits an event to the processor.
      Parameters:
      input - event
    • start

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.springframework.context.Lifecycle
    • stop

      public void stop(Runnable callback)
      Specified by:
      stop in interface org.springframework.context.SmartLifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle
    • getName

      public String getName()
      Gets the name of this processor.
      Returns:
      name
    • consumer

      protected abstract Consumer<T> consumer()
      Gets the consumer function that will consume events sent to this processor.
      Returns:
      event consumer