java.lang.Object
nl.pim16aap2.animatedarchitecture.core.api.restartable.RestartableHolder
All Implemented Interfaces:
IDebuggable

public final class RestartableHolder extends Object implements IDebuggable
Represents an object that can issue a restart or shutdown to IRestartable objects.
  • Constructor Details

    • RestartableHolder

      public RestartableHolder()
  • Method Details

    • registerRestartable

      public void registerRestartable(IRestartable restartable)
      Register a IRestartable object with this object, so this object can restart the provided object.
      Parameters:
      restartable - A IRestartable object that can be restarted by this object.
      Throws:
      NullPointerException - If the provided restartable is null.
    • isRestartableRegistered

      public boolean isRestartableRegistered(@Nullable @Nullable IRestartable restartable)
      Checks if a IRestartable has been registered with this object.
      Parameters:
      restartable - The IRestartable to check.
      Returns:
      True if the IRestartable has been registered with this object.
    • deregisterRestartable

      public void deregisterRestartable(IRestartable restartable)
      Deregisters an IRestartable if it is currently registered.
      Parameters:
      restartable - The IRestartable to deregister.
      Throws:
      NullPointerException - If the provided restartable is null.
    • restart

      public void restart()
      Restarts all restartables.

      This is the same as manually calling shutDown() and then initialize().

    • initialize

      public void initialize()
      Calls IRestartable.initialize() for all registered IRestartables.
    • shutDown

      public void shutDown()
      Calls IRestartable.shutDown() for all registered IRestartables.

      The restartables are shut down in reverse order to ensure that dependents are processed before their dependencies are.

    • getDebugInformation

      public String getDebugInformation()
      Description copied from interface: IDebuggable
      Gets the debug information for this object.
      Specified by:
      getDebugInformation in interface IDebuggable
      Returns:
      The debug information or null if there's nothing to log at this time.