Class ArchiveManager

  • All Implemented Interfaces:
    Module

    public class ArchiveManager
    extends BasicModule
    A manager of tasks that write archives into storage.
    Author:
    Guus der Kinderen, guus.der.kinderen@gmail.com
    • Field Detail

      • EXECUTOR_CORE_POOL_SIZE

        public static final SystemProperty<Integer> EXECUTOR_CORE_POOL_SIZE
        The number of threads to keep in the thread pool that writes messages to the database, even if they are idle.
      • EXECUTOR_MAX_POOL_SIZE

        public static final SystemProperty<Integer> EXECUTOR_MAX_POOL_SIZE
        The maximum number of threads to allow in the thread pool that writes messages to the database.
      • EXECUTOR_POOL_KEEP_ALIVE

        public static final SystemProperty<Duration> EXECUTOR_POOL_KEEP_ALIVE
        The number of threads in the thread pool that writes messages to the database is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating.
    • Constructor Detail

      • ArchiveManager

        public ArchiveManager()
    • Method Detail

      • initialize

        public void initialize​(XMPPServer server)
        Initializes the manager, by instantiating a thread pool that is used to process archiving tasks.
        Specified by:
        initialize in interface Module
        Overrides:
        initialize in class BasicModule
        Parameters:
        server - the server hosting this module.
      • destroy

        public void destroy()
        Destroys the module, by shutting down the thread pool that is being used to process archiving tasks. No new archive tasks will be accepted any longer, although previously scheduled tasks can continue to be processed.
        Specified by:
        destroy in interface Module
        Overrides:
        destroy in class BasicModule
      • add

        public void add​(Archiver archiver)
        Adds a new task, that is started immediately.
        Parameters:
        archiver - The task to be added. Cannot be null.
      • remove

        public void remove​(Archiver archiver)
        Stops and removes an exiting task. No-op when the provided task is not managed by this manager.
        Parameters:
        archiver - The task to be added. Cannot be null.
      • remove

        public void remove​(String id)
        Stops and removes an existing task. No-op when the provided task is not managed by this manager.
        Parameters:
        id - The identifier of task to be added. Cannot be null.
      • availabilityETAOnLocalNode

        public Duration availabilityETAOnLocalNode​(String id,
                                                   Instant instant)