Class Utils


  • public class Utils
    extends Object
    • Field Detail

      • DEPLOYMENT_PROCESSING_STATUS

        protected static final List<String> DEPLOYMENT_PROCESSING_STATUS
    • Constructor Detail

      • Utils

        public Utils()
    • Method Detail

      • pollUntil

        public static <T> T pollUntil​(Callable<T> callable,
                                      @Nonnull
                                      java.util.function.Predicate<T> predicate,
                                      int timeOutInSeconds)
        Get resource repeatedly until it match the predicate or timeout, will return null when meet exception with default pollingInterval = 1s
        Parameters:
        callable - callable to get resource
        predicate - function that evaluate the resource
        timeOutInSeconds - max time for the method
        Returns:
        the first resource which fit the predicate or the last result before timeout
      • pollUntil

        public static <T> T pollUntil​(Callable<T> callable,
                                      @Nonnull
                                      java.util.function.Predicate<T> predicate,
                                      int timeOutInSeconds,
                                      int pollingInterval)
        Get resource repeatedly until it match the predicate or timeout, will return null when meet exception
        Parameters:
        callable - callable to get resource
        predicate - function that evaluate the resource
        timeOutInSeconds - max time for the method
        pollingInterval - polling interval
        Returns:
        the first resource which fit the predicate or the last result before timeout