Class Actions


  • public final class Actions
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Actions()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ReloadAction abortIf​(java.lang.Object service, java.util.function.BiPredicate<SourceVersion,​SourceVersion> versionPredicate)
      Aborts reload of the target service if the versionPredicate returns true.
      static <T> ReloadAction abortIf​(java.util.function.Predicate<RessorService<T>> predicate)  
      static ReloadAction and​(ReloadAction... actions)
      Runs the actions and combine the results with AND operator.
      static ReloadAction andParallel​(ReloadAction... actions)
      Runs all the actions in parallel, wait for the results and combine them with AND operator.
      static ReloadAction or​(ReloadAction... actions)
      Runs the actions and combine the results with OR operator.
      static ReloadAction orParallel​(ReloadAction... actions)
      Runs all the actions in parallel, wait for the results and combine them with OR operator.
      static ReloadAction triggerAndWaitReload​(java.lang.Object service)
      Triggers synchronous reload of the service, making the target service wait for its result first.
      static ReloadAction triggerReload​(java.lang.Object service)
      Triggers the asynchronous reload of the service when the target service is being reloaded and returns true immediately, without waiting for the result.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Actions

        public Actions()
    • Method Detail

      • triggerReload

        public static ReloadAction triggerReload​(java.lang.Object service)
        Triggers the asynchronous reload of the service when the target service is being reloaded and returns true immediately, without waiting for the result. Target service is provided in ReloadAction.perform(RessorService) call.
        Parameters:
        service - the service which should be reloaded when the target service is reloading
        Returns:
        action
      • triggerAndWaitReload

        public static ReloadAction triggerAndWaitReload​(java.lang.Object service)
        Triggers synchronous reload of the service, making the target service wait for its result first. If reload is successful, target service proceed with its own reload, otherwise it aborts. Target service is provided in ReloadAction.perform(RessorService) call.
        Parameters:
        service - the service which should be reloaded when the target service is reloading
        Returns:
        action
      • abortIf

        public static ReloadAction abortIf​(java.lang.Object service,
                                           java.util.function.BiPredicate<SourceVersion,​SourceVersion> versionPredicate)
        Aborts reload of the target service if the versionPredicate returns true. Target service is provided in ReloadAction.perform(RessorService) call.
        Parameters:
        service - which version is being compared with the target service
        versionPredicate - predicate, which has the target service latest version on left and the provided service latest version on right
        Returns:
        action
      • or

        public static ReloadAction or​(ReloadAction... actions)
        Runs the actions and combine the results with OR operator.
        Parameters:
        actions - actions to be performed
        Returns:
        action
      • and

        public static ReloadAction and​(ReloadAction... actions)
        Runs the actions and combine the results with AND operator.
        Parameters:
        actions - actions to be performed
        Returns:
        action
      • andParallel

        public static ReloadAction andParallel​(ReloadAction... actions)
        Runs all the actions in parallel, wait for the results and combine them with AND operator.
        Parameters:
        actions - actions to be performed in parallel to each other
        Returns:
        action
      • orParallel

        public static ReloadAction orParallel​(ReloadAction... actions)
        Runs all the actions in parallel, wait for the results and combine them with OR operator.
        Parameters:
        actions - actions to be performed in parallel to each other
        Returns:
        action