Class CompositeLifecycle

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

public final class CompositeLifecycle extends Object implements Iterable<org.springframework.context.Lifecycle>, org.springframework.context.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
See Also:
  • Field Summary

    Fields inherited from interface org.springframework.context.SmartLifecycle

    DEFAULT_PHASE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(org.springframework.context.Lifecycle lifecycleComponent)
    Adds a Lifecycle object to this composite.
    boolean
    Returns a boolean value indicating whether this composite contains any Lifecycle objects.
    boolean
    Determines whether any Lifecycle object contained by this composite is running.
    Iterator<org.springframework.context.Lifecycle>
    Returns an Iterator over the Lifecycle objects contained by this composite.
    boolean
    remove(org.springframework.context.Lifecycle lifecycleComponent)
    Removes the given Lifecycle object from this composite.
    int
    Returns the number of Lifecycle objects contained by this composite.
    void
    Starts all Lifecycle objects contained by this composite.
    void
    Stops all Lifecycle objects contained by this composite.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator

    Methods inherited from interface org.springframework.context.SmartLifecycle

    getPhase, isAutoStartup, stop
  • Constructor Details

    • CompositeLifecycle

      public CompositeLifecycle()
  • Method Details

    • add

      public boolean add(@NonNull org.springframework.context.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<org.springframework.context.Lifecycle> iterator()
      Returns an Iterator over the Lifecycle objects contained by this composite.
      Specified by:
      iterator in interface Iterable<org.springframework.context.Lifecycle>
      Returns:
      an Iterator over the Lifecycle objects contained by this composite.
      See Also:
    • remove

      public boolean remove(@Nullable org.springframework.context.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 org.springframework.context.Lifecycle
      Returns:
      a boolean value indicating whether any Lifecycle object contained by this composite is running.
      See Also:
      • Lifecycle.isRunning()
    • start

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

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