Class ServiceCreateRetryConfiguration

java.lang.Object
eu.cloudnetservice.driver.service.ServiceCreateRetryConfiguration
All Implemented Interfaces:
Cloneable

public class ServiceCreateRetryConfiguration extends Object implements Cloneable
A configuration applied when the initial creation of a service fails. The caller has the ability to specify how the retry of the service creation should be done. Additionally, if the service creation was deferred the further state changes will be published to the configured event receivers.
Since:
4.0
  • Field Details

  • Constructor Details

    • ServiceCreateRetryConfiguration

      protected ServiceCreateRetryConfiguration(int maxRetries, @NonNull @NonNull List<Long> backoffStrategy, @NonNull @NonNull Map<ServiceCreateResult.State, List<ChannelMessageTarget>> eventReceivers)
      Constructs a new retry configuration instance.
      Parameters:
      maxRetries - the maximum amount of retries for the service creation.
      backoffStrategy - the strategy to apply to delay the service creation based on executed times.
      eventReceivers - the receivers of state events if the creation was deferred.
      Throws:
      NullPointerException - if the given backoff strategy or event receivers are null.
  • Method Details

    • builder

      Constructs a new builder instance for a retry configuration.
      Returns:
      a new retry configuration builder.
    • builder

      Creates a new retry configuration builder which has the same options set as the given retry configuration. Changes made to the given configuration will not reflect into the new builder and vice-versa.

      When calling build directly after creating the builder based on the given retry configuration it will return a retry configuration which is equal to the given one, but not identical.

      Parameters:
      retryConfiguration - the configuration to copy the set options of.
      Returns:
      a new builder instance which has the same options set as the given configuration.
      Throws:
      NullPointerException - if the given configuration is null.
    • enabled

      public boolean enabled()
      Checks if this configuration is enabled, in other words if there is at least one retry and delay specified.
      Returns:
      if this configuration is enabled.
    • maxRetries

      public int maxRetries()
      Get the maximum number of retries until the retry process should stop. Negative values or zero indicate that no retry attempts should be made.
      Returns:
      the maximum number of retries.
    • backoffStrategy

      @NonNull public @Unmodifiable @NonNull List<Long> backoffStrategy()
      Get an unmodifiable copy of the backoff strategy which should be applied when retrying the service creation. An empty list indicates that no retry attempts should be made.
      Returns:
      the backoff strategy which should be applied when retrying the service creation.
    • eventReceivers

      Get an unmodifiable copy of the event receivers which should get notified about state change events if the service creation was deferred. The listeners won't be called if the service creation succeeded or failed without any retries.
      Returns:
      the event receivers for deferred service state changes.
    • clone

      Overrides:
      clone in class Object