Enum ThreadWatchdogs

    • Method Detail

      • values

        public static ThreadWatchdogs[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ThreadWatchdogs c : ThreadWatchdogs.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ThreadWatchdogs valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • newInstance

        public ThreadWatchdog newInstance​(long interval,
                                          long maxExecutionTime,
                                          LongSupplier relativeTimeSupplier,
                                          BiFunction<Long,​Runnable,​ScheduledFuture<?>> scheduler)
        Returns an implementation that checks for each fixed interval if there are threads that have invoked ThreadWatchdog.register() and not ThreadWatchdog.unregister() and have been in this state for longer than the specified max execution interval and then interrupts these threads.
        Parameters:
        interval - The fixed interval to check if there are threads to interrupt
        maxExecutionTime - The time a thread has the execute an operation.
        relativeTimeSupplier - A supplier that returns relative time
        scheduler - A scheduler that is able to execute a command for each fixed interval
      • noop

        public ThreadWatchdog noop()
        Returns:
        A noop implementation that does not interrupt threads and is useful for testing and pre-defined grok expressions.