Class ShutdownManager

  • All Implemented Interfaces:
    org.forgerock.util.thread.listener.ShutdownManager

    public final class ShutdownManager
    extends Object
    implements org.forgerock.util.thread.listener.ShutdownManager
    ShutdownManager is a static instance which is used to trigger all the ShutdownListener to call shutdown function.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Set<org.forgerock.util.thread.listener.ShutdownListener>[] listeners  
      protected boolean shutdownCalled  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addApplicationSSOTokenDestroyer​(org.forgerock.util.thread.listener.ShutdownListener listener)
      Adds application single-sign-on token destroyer.
      void addShutdownListener​(org.forgerock.util.thread.listener.ShutdownListener listener)
      Adds a ShutdownListener to this ShutdownManager.
      void addShutdownListener​(org.forgerock.util.thread.listener.ShutdownListener listener, org.forgerock.util.thread.listener.ShutdownPriority priority)
      Adds a ShutdownListener to this ShutdownManager with indicated level.
      static ShutdownManager getInstance()
      Returns the static instance of ShutdownManager in the VM.
      void removeShutdownListener​(org.forgerock.util.thread.listener.ShutdownListener listener)
      Removes a ShutdownListener from this ShutdownManager.
      void replaceShutdownListener​(org.forgerock.util.thread.listener.ShutdownListener oldListener, org.forgerock.util.thread.listener.ShutdownListener newListener, org.forgerock.util.thread.listener.ShutdownPriority priority)
      Replaces an existing ShutdownListener with the new ShutdownListener.
      void shutdown()
      Shuts down all the listeners in this ShutdownManager.
    • Field Detail

      • listeners

        protected Set<org.forgerock.util.thread.listener.ShutdownListener>[] listeners
      • shutdownCalled

        protected volatile boolean shutdownCalled
    • Method Detail

      • getInstance

        public static ShutdownManager getInstance()
        Returns the static instance of ShutdownManager in the VM.
        Returns:
        The static instance of ShutdownManager
      • addShutdownListener

        public void addShutdownListener​(org.forgerock.util.thread.listener.ShutdownListener listener)
                                 throws IllegalMonitorStateException
        Adds a ShutdownListener to this ShutdownManager.
        Specified by:
        addShutdownListener in interface org.forgerock.util.thread.listener.ShutdownManager
        Parameters:
        listener - The listener to be added
        Throws:
        IllegalMonitorStateException
      • addShutdownListener

        public void addShutdownListener​(org.forgerock.util.thread.listener.ShutdownListener listener,
                                        org.forgerock.util.thread.listener.ShutdownPriority priority)
                                 throws IllegalMonitorStateException
        Adds a ShutdownListener to this ShutdownManager with indicated level.
        Specified by:
        addShutdownListener in interface org.forgerock.util.thread.listener.ShutdownManager
        Parameters:
        listener - The listener to be added
        priority - The priority to shutdown for the shutdown listener
        Throws:
        IllegalMonitorStateException
      • replaceShutdownListener

        public void replaceShutdownListener​(org.forgerock.util.thread.listener.ShutdownListener oldListener,
                                            org.forgerock.util.thread.listener.ShutdownListener newListener,
                                            org.forgerock.util.thread.listener.ShutdownPriority priority)
        Replaces an existing ShutdownListener with the new ShutdownListener.
        Specified by:
        replaceShutdownListener in interface org.forgerock.util.thread.listener.ShutdownManager
        Parameters:
        oldListener - To be replaced.
        newListener - The replacement.
        priority - Replacement listeners priority. If null default addShutdownListener method will be used.
      • removeShutdownListener

        public void removeShutdownListener​(org.forgerock.util.thread.listener.ShutdownListener listener)
                                    throws IllegalMonitorStateException
        Removes a ShutdownListener from this ShutdownManager.
        Specified by:
        removeShutdownListener in interface org.forgerock.util.thread.listener.ShutdownManager
        Parameters:
        listener - The listener to be removed
        Throws:
        IllegalMonitorStateException
      • addApplicationSSOTokenDestroyer

        public void addApplicationSSOTokenDestroyer​(org.forgerock.util.thread.listener.ShutdownListener listener)
        Adds application single-sign-on token destroyer.
        Parameters:
        listener - Listener object.