Class CompositeLifecycle

java.lang.Object
org.springframework.data.gemfire.support.CompositeLifecycle
All Implemented Interfaces:
Iterable<Lifecycle>, Lifecycle, Phased, SmartLifecycle

public final class CompositeLifecycle extends Object implements Iterable<Lifecycle>, SmartLifecycle
A Spring Lifecycle that implements the Composite software design pattern composing 1 or more Lifecycle components as a single, logical, composite Lifecycle object.
Since:
2.2.0
Author:
John Blum
See Also:
  • Constructor Details

    • CompositeLifecycle

      public CompositeLifecycle()
  • Method Details

    • add

      public boolean add(@NonNull Lifecycle lifecycleComponent)
      Adds a Lifecycle object to this composite.
      Parameters:
      lifecycleComponent - Lifecycle object to add to this composite.
      Returns:
      a boolean value if the Lifecycle object is not null and was successfully added to this composite.
      See Also:
    • isEmpty

      public boolean isEmpty()
      Returns a boolean value indicating whether this composite contains any Lifecycle objects.
      Returns:
      a boolean value indicating whether this composite contains any Lifecycle objects.
    • iterator

      public Iterator<Lifecycle> iterator()
      Returns an Iterator over the Lifecycle objects contained by this composite.
      Specified by:
      iterator in interface Iterable<Lifecycle>
      Returns:
      an Iterator over the Lifecycle objects contained by this composite.
      See Also:
    • remove

      public boolean remove(@Nullable Lifecycle lifecycleComponent)
      Removes the given Lifecycle object from this composite.
      Parameters:
      lifecycleComponent - Lifecycle object to remove.
      Returns:
      a boolean if the Lifecycle object was part of this composite and was able to be removed successfully.
      See Also:
    • size

      public int size()
      Returns the number of Lifecycle objects contained by this composite.
      Returns:
      an integer value specifying the number of Lifecycle objects contained by this composite.
    • isRunning

      public boolean isRunning()
      Determines whether any Lifecycle object contained by this composite is running.
      Specified by:
      isRunning in interface Lifecycle
      Returns:
      a boolean value indicating whether any Lifecycle object contained by this composite is running.
      See Also:
    • start

      public void start()
      Starts all Lifecycle objects contained by this composite.
      Specified by:
      start in interface Lifecycle
      See Also:
    • stop

      public void stop()
      Stops all Lifecycle objects contained by this composite.
      Specified by:
      stop in interface Lifecycle
      See Also: