public class CombinedReloadingController extends ReloadingController
A specialized ReloadingController
implementation which manages an arbitrary number of other
ReloadingController
objects.
This class can be used to handle multiple simple controllers for reload operations as a single object. As a usage
example consider a combined configuration containing a number of configuration sources of which some support
reloading. In this scenario all ReloadingController
instances for the reloading-enabled sources can be added
to a CombinedReloadingController
. Then by triggering the combined controller a reload check is performed on
all child sources.
This class is a typical implementation of the composite pattern. An instance is constructed with a
collection of sub ReloadingController
objects. Its operations are implemented by delegating to all child
controllers.
This class expects the managed controller objects to be passed to the constructor. From this list a defensive copy is
created so that it cannot be changed later on. Derived classes can override the getSubControllers()
method
if they need another way to handle child controllers (e.g. a more dynamic way). However, they are then responsible to
ensure a safe access to this list in a multi-threaded environment.
Constructor and Description |
---|
CombinedReloadingController(Collection<? extends ReloadingController> subCtrls)
Creates a new instance of
CombinedReloadingController and initializes it with the ReloadingController
objects to be managed. |
Modifier and Type | Method and Description |
---|---|
ReloadingDetector |
getDetector()
Returns the
ReloadingDetector used by this controller. |
Collection<ReloadingController> |
getSubControllers()
Returns a (unmodifiable) collection with the sub controllers managed by this combined controller.
|
void |
resetInitialReloadingState()
Resets the reloading state of all managed sub controllers unconditionally.
|
addEventListener, checkForReloading, isInReloadingState, removeEventListener, resetReloadingState
public CombinedReloadingController(Collection<? extends ReloadingController> subCtrls)
CombinedReloadingController
and initializes it with the ReloadingController
objects to be managed.subCtrls
- the collection with sub ReloadingController
s (must not be null or contain null
entries)IllegalArgumentException
- if the passed in collection is null or contains null entriespublic Collection<ReloadingController> getSubControllers()
public ReloadingDetector getDetector()
ReloadingDetector
used by this controller. This implementation returns a special reloading detector which operates on all managed controllers.getDetector
in class ReloadingController
ReloadingDetector
public void resetInitialReloadingState()
Copyright © 2001–2022 The Apache Software Foundation. All rights reserved.