Class Actions


  • @ProviderType
    public final class Actions
    extends Object
    Various deferred actions to be used with the ActionManager
    • Method Detail

      • getCurrentActionManager

        public static ActionManager getCurrentActionManager()
        Obtain the current action manager -- this is necessary for additional tracking such as current item
        Returns:
        current action manager
      • setCurrentActionManager

        public static void setCurrentActionManager​(ActionManager a)
      • setCurrentItem

        public static void setCurrentItem​(String item)
      • retryAll

        public static final CheckedBiConsumer<org.apache.sling.api.resource.ResourceResolver,​String> retryAll​(int retries,
                                                                                                                    long pausePerRetry,
                                                                                                                    CheckedBiConsumer<org.apache.sling.api.resource.ResourceResolver,​String> action)
        Retry provided action a given number of times before giving up and throwing an error. Before each retry attempt, the resource resolver is reverted so when using this it is a good idea to commit from your action directly.
        Parameters:
        retries - Number of retries to attempt
        pausePerRetry - Milliseconds to wait between attempts
        action - Action to attempt
        Returns:
        New retry wrapper around provided action
      • retry

        public static final CheckedConsumer<org.apache.sling.api.resource.ResourceResolver> retry​(int retries,
                                                                                                  long pausePerRetry,
                                                                                                  CheckedConsumer<org.apache.sling.api.resource.ResourceResolver> action)
        Retry a single action
        Parameters:
        retries - Number of retries to attempt
        pausePerRetry - Milliseconds to wait between attempts
        action - Action to attempt
        Returns:
        New retry wrapper around provided action