Class IdlePurgePolicy

    • Field Detail

      • timeToLive

        private final long timeToLive
      • checkInterval

        private final long checkInterval
      • appendersUsage

        private final java.util.concurrent.ConcurrentMap<java.lang.String,​java.lang.Long> appendersUsage
      • future

        private volatile java.util.concurrent.ScheduledFuture<?> future
    • Constructor Detail

      • IdlePurgePolicy

        public IdlePurgePolicy​(long timeToLive,
                               long checkInterval,
                               ConfigurationScheduler scheduler)
    • Method Detail

      • stop

        public boolean stop​(long timeout,
                            java.util.concurrent.TimeUnit timeUnit)
        Description copied from interface: LifeCycle2
        Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.
        Specified by:
        stop in interface LifeCycle2
        Overrides:
        stop in class AbstractLifeCycle
        Parameters:
        timeout - the maximum time to wait
        timeUnit - the time unit of the timeout argument
        Returns:
        true if the receiver was stopped cleanly and normally, false otherwise.
      • purge

        public void purge()
        Purging appenders that were not in use specified time
        Specified by:
        purge in interface PurgePolicy
      • update

        public void update​(java.lang.String key,
                           LogEvent event)
        Specified by:
        update in interface PurgePolicy
        Parameters:
        key - routed appender key
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • scheduleNext

        private void scheduleNext()
      • createPurgePolicy

        @PluginFactory
        public static PurgePolicy createPurgePolicy​(@PluginAttribute("timeToLive")
                                                    java.lang.String timeToLive,
                                                    @PluginAttribute("checkInterval")
                                                    java.lang.String checkInterval,
                                                    @PluginAttribute("timeUnit")
                                                    java.lang.String timeUnit,
                                                    @PluginConfiguration
                                                    Configuration configuration)
        Create the PurgePolicy
        Parameters:
        timeToLive - the number of increments of timeUnit before the Appender should be purged.
        checkInterval - when all appenders purged, the number of increments of timeUnit to check if any appenders appeared
        timeUnit - the unit of time the timeToLive and the checkInterval is expressed in.
        Returns:
        The Routes container.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object