Package de.dlr.proseo.model.util
Class ProseoUtil
java.lang.Object
de.dlr.proseo.model.util.ProseoUtil
Class to hold general utility methods
- Author:
- Ernst Melchinger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMaximum number of retries for database concurrency issuesstatic final intWait interval in ms before retrying database operationstatic final intMaximum number of retries for Kubernetes API issuesstatic final intWait interval in ms before retrying Kubernetes API operation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddbWait()Wait a slightly randomized amount of time based on database wait parametersstatic voiddbWait(int attempt) Wait a slightly randomized amount of time based on database wait parameters (increasing progressively with the number of attempts)static StringEscape a give String to make it safe to be printed or stored.static StringextractProseoMessage(String warningHeader) Extracts the prosEO-compliant message from the "Warning" header, if anystatic voidkubeWait()Wait a slightly randomized amount of time based on Kubernetes wait parametersstatic voidkubeWait(int attempt) Wait a slightly randomized amount of time based on Kubernetes wait parameters (increasing progressively with the number of attempts)static voidrandomWait(int attempt, int waitInterval) Wait a slightly randomized amount of time, increasing progressively with the number of attempts
-
Field Details
-
DB_MAX_RETRY
public static final int DB_MAX_RETRYMaximum number of retries for database concurrency issues- See Also:
-
DB_WAIT
public static final int DB_WAITWait interval in ms before retrying database operation- See Also:
-
K8S_MAX_RETRY
public static final int K8S_MAX_RETRYMaximum number of retries for Kubernetes API issues- See Also:
-
K8S_WAIT
public static final int K8S_WAITWait interval in ms before retrying Kubernetes API operation- See Also:
-
-
Constructor Details
-
ProseoUtil
public ProseoUtil()
-
-
Method Details
-
escape
Escape a give String to make it safe to be printed or stored.- Parameters:
s- The input String.- Returns:
- The output String.
-
extractProseoMessage
Extracts the prosEO-compliant message from the "Warning" header, if any- Parameters:
warningHeader- the HTTP Warning header to extract the message from- Returns:
- the prosEO-compliant message, if there is one, or the unchanged warning header, if there is one, or null otherwise
-
randomWait
public static void randomWait(int attempt, int waitInterval) Wait a slightly randomized amount of time, increasing progressively with the number of attempts- Parameters:
attempt- the retry attempt countwaitInterval- the base wait interval to apply
-
dbWait
public static void dbWait()Wait a slightly randomized amount of time based on database wait parameters -
dbWait
public static void dbWait(int attempt) Wait a slightly randomized amount of time based on database wait parameters (increasing progressively with the number of attempts)- Parameters:
attempt- the retry attempt count
-
kubeWait
public static void kubeWait()Wait a slightly randomized amount of time based on Kubernetes wait parameters -
kubeWait
public static void kubeWait(int attempt) Wait a slightly randomized amount of time based on Kubernetes wait parameters (increasing progressively with the number of attempts)- Parameters:
attempt- the retry attempt count
-