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:
-
Iterable
Lifecycle
SmartLifecycle
-
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(org.springframework.context.Lifecycle lifecycleComponent) Adds aLifecycle
object to this composite.boolean
isEmpty()
Returns a boolean value indicating whether this composite contains anyLifecycle
objects.boolean
Determines whether anyLifecycle
object contained by this composite is running.Iterator<org.springframework.context.Lifecycle>
iterator()
Returns anIterator
over theLifecycle
objects contained by this composite.boolean
remove
(org.springframework.context.Lifecycle lifecycleComponent) Removes the givenLifecycle
object from this composite.int
size()
Returns the number ofLifecycle
objects contained by this composite.void
start()
Starts allLifecycle
objects contained by this composite.void
stop()
Stops allLifecycle
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 aLifecycle
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 anyLifecycle
objects.- Returns:
- a boolean value indicating whether this composite contains any
Lifecycle
objects.
-
iterator
Returns anIterator
over theLifecycle
objects contained by this composite. -
remove
public boolean remove(@Nullable org.springframework.context.Lifecycle lifecycleComponent) Removes the givenLifecycle
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 ofLifecycle
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 anyLifecycle
object contained by this composite is running.- Specified by:
isRunning
in interfaceorg.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 allLifecycle
objects contained by this composite.- Specified by:
start
in interfaceorg.springframework.context.Lifecycle
- See Also:
-
stop
public void stop()Stops allLifecycle
objects contained by this composite.- Specified by:
stop
in interfaceorg.springframework.context.Lifecycle
- See Also:
-