Interface Task

All Superinterfaces:
Cancelable, Runnable, SchedulingAwareRunnable

public interface Task extends SchedulingAwareRunnable, Cancelable
The actual Task to run within the StreamMessageListenerContainer.
Since:
2.2
Author:
Mark Paluch
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    The Task.State defining the lifecycle phase the actual Task.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Synchronous, blocking call that awaits until this Task becomes active.
    Get the current lifecycle phase.
    default boolean
     

    Methods inherited from interface org.springframework.data.redis.stream.Cancelable

    cancel

    Methods inherited from interface java.lang.Runnable

    run

    Methods inherited from interface org.springframework.scheduling.SchedulingAwareRunnable

    getQualifier, isLongLived
  • Method Details

    • isActive

      default boolean isActive()
      Returns:
      true if the task is currently running.
    • getState

      Task.State getState()
      Get the current lifecycle phase.
      Returns:
      never null.
    • awaitStart

      boolean awaitStart(Duration timeout) throws InterruptedException
      Synchronous, blocking call that awaits until this Task becomes active. Start awaiting is rearmed after cancelling to support restart.
      Parameters:
      timeout - must not be null.
      Returns:
      true if the task was started. false if the waiting time elapsed before task was started.
      Throws:
      InterruptedException - if the current thread is interrupted while waiting.