Class FailureSettings


  • public class FailureSettings
    extends java.lang.Object
    Settings for task execution strategy in case of failure.
    Since:
    01.10.2021
    • Method Detail

      • getRetryType

        @Nonnull
        public FailRetryType getRetryType()
        Get task execution retry strategy in case of failure.
        Returns:
        Task execution retry strategy.
      • getRetryInterval

        @Nonnull
        public java.time.Duration getRetryInterval()
        Get retry interval for task execution in case of failure.
        Returns:
        Task retry interval.
        See Also:
        FailRetryType
      • builder

        public static FailureSettings.Builder builder()
        Create a new builder for failure settings.
        Returns:
        A new builder for failure settings.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

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

        @Nonnull
        protected java.lang.String getName()
        Name of setting
        Returns:
        name
      • getDiffEvaluator

        @Nonnull
        protected java.util.function.BiFunction<FailureSettings,​FailureSettings,​java.lang.String> getDiffEvaluator()
        Function evaluates difference between new and old value. 1st argument - old value, 2nd argument - new value.
        Returns:
        difference between two values
      • getThis

        @Nonnull
        protected FailureSettings getThis()
        Return typed reference of current object
        Returns:
        current object
      • copyFields

        protected void copyFields​(@Nonnull
                                  FailureSettings newValue)
        Copy fields of new object to current object.
        Parameters:
        newValue - new value
      • setValue

        public final java.util.Optional<java.lang.String> setValue​(@Nonnull
                                                                   T newValue)
        Sets new value for current setting. Notifies observer when property is changed.
        Parameters:
        newValue - new value for setting
        Returns:
        diff between old value and new value. Returns empty object when no changes detected.
        See Also:
        DynamicSetting.registerObserver(BiConsumer)
      • registerObserver

        public final void registerObserver​(java.util.function.BiConsumer<T,​T> observer)
        Register observer to track setting changes.
        Parameters:
        observer - consumer which will be notified on property change. 1st argument - old value, 2nd argument - new value