Class Utils
- java.lang.Object
-
- com.microsoft.azure.toolkit.lib.springcloud.Utils
-
public class Utils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description private static intPOLLING_INTERVAL
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisDeploymentDone(SpringCloudDeployment deployment)private static booleanisInteger(double sizeInGB)static <T> TpollUntil(Callable<T> callable, 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 = 1sstatic <T> TpollUntil(Callable<T> callable, 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 exceptionstatic StringtoCpuString(double cpuCount)Converts cpu count from double to Stringstatic StringtoMemoryString(double sizeInGB)Converts memory count from double to String
-
-
-
Field Detail
-
POLLING_INTERVAL
private static final int POLLING_INTERVAL
- See Also:
- Constant Field Values
-
-
Method Detail
-
isDeploymentDone
public static boolean isDeploymentDone(@Nullable SpringCloudDeployment deployment)
-
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 resourcepredicate- function that evaluate the resourcetimeOutInSeconds- 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 resourcepredicate- function that evaluate the resourcetimeOutInSeconds- max time for the methodpollingInterval- polling interval- Returns:
- the first resource which fit the predicate or the last result before timeout
-
toCpuString
public static String toCpuString(double cpuCount)
Converts cpu count from double to String- Parameters:
cpuCount- cpu count, 1 core can be represented by 1 or 1000m- Returns:
- cpu String
-
toMemoryString
public static String toMemoryString(double sizeInGB)
Converts memory count from double to String- Parameters:
sizeInGB- memory in GB- Returns:
- memory String
-
isInteger
private static boolean isInteger(double sizeInGB)
-
-