Class RestartableHolder
java.lang.Object
nl.pim16aap2.animatedarchitecture.core.api.restartable.RestartableHolder
- All Implemented Interfaces:
IDebuggable
Represents an object that can issue a restart or shutdown to
IRestartable objects.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidderegisterRestartable(IRestartable restartable) Deregisters anIRestartableif it is currently registered.Gets the debug information for this object.voidCallsIRestartable.initialize()for all registeredIRestartables.booleanisRestartableRegistered(@Nullable IRestartable restartable) Checks if aIRestartablehas been registered with this object.voidregisterRestartable(IRestartable restartable) Register aIRestartableobject with this object, so this object can restart the provided object.voidrestart()Restarts allrestartables.voidshutDown()CallsIRestartable.shutDown()for all registeredIRestartables.
-
Constructor Details
-
RestartableHolder
public RestartableHolder()
-
-
Method Details
-
registerRestartable
Register aIRestartableobject with this object, so this object can restart the provided object.- Parameters:
restartable- AIRestartableobject that can be restarted by this object.- Throws:
NullPointerException- If the provided restartable is null.
-
isRestartableRegistered
Checks if aIRestartablehas been registered with this object.- Parameters:
restartable- TheIRestartableto check.- Returns:
- True if the
IRestartablehas been registered with this object.
-
deregisterRestartable
Deregisters anIRestartableif it is currently registered.- Parameters:
restartable- TheIRestartableto deregister.- Throws:
NullPointerException- If the provided restartable is null.
-
restart
public void restart()Restarts allrestartables.This is the same as manually calling
shutDown()and theninitialize(). -
initialize
public void initialize()CallsIRestartable.initialize()for all registeredIRestartables. -
shutDown
public void shutDown()CallsIRestartable.shutDown()for all registeredIRestartables.The
restartablesare shut down in reverse order to ensure that dependents are processed before their dependencies are. -
getDebugInformation
Description copied from interface:IDebuggableGets the debug information for this object.- Specified by:
getDebugInformationin interfaceIDebuggable- Returns:
- The debug information or null if there's nothing to log at this time.
-