Skip to content

Commit

Permalink
Merge pull request #42964 from dsplayerX/fix_42922_8.7-stage
Browse files Browse the repository at this point in the history
Address review suggestions of #42950
  • Loading branch information
chiranSachintha committed Jun 21, 2024
2 parents dfabb78 + f62a945 commit fa2e27f
Showing 1 changed file with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,15 @@ private String getTransactionLogDirectory() {
public static int getTransactionAutoCommitTimeout() {
VariableKey transactionAutoCommitTimeoutKey = new VariableKey(TRANSACTION_PACKAGE_ID,
TRANSACTION_AUTO_COMMIT_TIMEOUT_KEY, PredefinedTypes.TYPE_INT, false);
Object value = ConfigMap.get(transactionAutoCommitTimeoutKey);
if (value == null) {
if (!ConfigMap.containsKey(transactionAutoCommitTimeoutKey)) {
return DEFAULT_TRX_AUTO_COMMIT_TIMEOUT;
} else {
Object configValue = ConfigMap.get(transactionAutoCommitTimeoutKey);
if (configValue == null) {
return DEFAULT_TRX_AUTO_COMMIT_TIMEOUT;
}
return parseTimeoutValue(configValue, DEFAULT_TRX_AUTO_COMMIT_TIMEOUT);
}
return parseTimeoutValue(value, DEFAULT_TRX_AUTO_COMMIT_TIMEOUT);
}

/**
Expand All @@ -214,15 +218,19 @@ public static int getTransactionCleanupTimeout() {
VariableKey transactionCleanupTimeoutKey = new VariableKey(TRANSACTION_PACKAGE_ID,
TRANSACTION_CLEANUP_TIMEOUT_KEY,
PredefinedTypes.TYPE_INT, false);
Object value = ConfigMap.get(transactionCleanupTimeoutKey);
if (value == null) {
return DEFAULT_TRX_CLEANUP_TIMEOUT;
if (!ConfigMap.containsKey(transactionCleanupTimeoutKey)) {
return DEFAULT_TRX_AUTO_COMMIT_TIMEOUT;
} else {
Object configValue = ConfigMap.get(transactionCleanupTimeoutKey);
if (configValue == null) {
return DEFAULT_TRX_CLEANUP_TIMEOUT;
}
return parseTimeoutValue(configValue, DEFAULT_TRX_CLEANUP_TIMEOUT);
}
return parseTimeoutValue(value, DEFAULT_TRX_CLEANUP_TIMEOUT);
}

private static int parseTimeoutValue(Object value, int defaultValue) {
if (!(value instanceof Number number)) {
private static int parseTimeoutValue(Object configValue, int defaultValue) {
if (!(configValue instanceof Number number)) {
return defaultValue;
}
int timeoutValue = number.intValue();
Expand Down

0 comments on commit fa2e27f

Please sign in to comment.