public final class CompositeLifecycle extends Object implements Iterable<Lifecycle>, SmartLifecycle
Lifecycle
that implements the Composite software design pattern composing 1 or more
Lifecycle
components as a single, logical, composite Lifecycle
object.Iterable
,
Lifecycle
,
SmartLifecycle
DEFAULT_PHASE
Constructor and Description |
---|
CompositeLifecycle() |
Modifier and Type | Method and Description |
---|---|
boolean |
add(Lifecycle lifecycleComponent)
Adds a
Lifecycle object to this composite. |
boolean |
isEmpty()
Returns a boolean value indicating whether this composite contains any
Lifecycle objects. |
boolean |
isRunning()
Determines whether any
Lifecycle object contained by this composite is running. |
Iterator<Lifecycle> |
iterator()
|
boolean |
remove(Lifecycle lifecycleComponent)
Removes the given
Lifecycle object from this composite. |
int |
size()
Returns the number of
Lifecycle objects contained by this composite. |
void |
start()
Starts all
Lifecycle objects contained by this composite. |
void |
stop()
Stops all
Lifecycle objects contained by this composite. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
getPhase, isAutoStartup, stop
public boolean add(@NonNull Lifecycle lifecycleComponent)
Lifecycle
object to this composite.lifecycleComponent
- Lifecycle
object to add to this composite.Lifecycle
object is not null
and was successfully added to this composite.remove(Lifecycle)
public boolean isEmpty()
Lifecycle
objects.Lifecycle
objects.public boolean remove(@Nullable Lifecycle lifecycleComponent)
Lifecycle
object from this composite.lifecycleComponent
- Lifecycle
object to remove.Lifecycle
object was part of this composite
and was able to be removed successfully.add(Lifecycle)
public int size()
Lifecycle
objects contained by this composite.Lifecycle
objects contained by this composite.public boolean isRunning()
Lifecycle
object contained by this composite is running.isRunning
in interface Lifecycle
Lifecycle
object
contained by this composite is running.Lifecycle.isRunning()
public void start()
Lifecycle
objects contained by this composite.Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.