Merge pull request #4516 from xenoamess-fork/int_overflow

bug: int overflow.
This commit is contained in:
kimmking
2023-03-05 00:27:25 +08:00
committed by GitHub
3 changed files with 6 additions and 6 deletions
@@ -83,7 +83,7 @@ public class RandomDataSourceRecoverThread implements Runnable {
if (validationSleepSeconds > 0) {
try {
LOG.debug("Sleep " + validationSleepSeconds + " second(s) before validation.");
Thread.sleep(validationSleepSeconds * 1000);
Thread.sleep(validationSleepSeconds * 1000L);
} catch (InterruptedException e) {
// ignore
}
@@ -92,7 +92,7 @@ public class RandomDataSourceRecoverThread implements Runnable {
private void sleep() {
try {
Thread.sleep(recoverIntervalSeconds * 1000);
Thread.sleep(recoverIntervalSeconds * 1000L);
} catch (InterruptedException e) {
// ignore
}
@@ -100,7 +100,7 @@ public class RandomDataSourceValidateThread implements Runnable {
try {
LOG.debug("[RandomDataSourceValidateThread@" + hashCode() + "] Sleep " + newSleepSeconds
+ " second(s) until next checking.");
Thread.sleep(newSleepSeconds * 1000);
Thread.sleep(newSleepSeconds * 1000L);
} catch (InterruptedException e) {
// ignore
}
@@ -213,8 +213,8 @@ public class RandomDataSourceValidateThread implements Runnable {
LOG.debug("DataSource=" + name + ", lastSuccessTime=" + lastSuccessTime
+ ", lastCheckTime=" + lastCheckTime + ", currentTime=" + currentTime);
return lastSuccessTime != null && lastCheckTime != null
&& (currentTime - lastSuccessTime) <= checkingIntervalSeconds * 1000
&& (currentTime - lastCheckTime) <= 5 * checkingIntervalSeconds * 1000
&& (currentTime - lastSuccessTime) <= checkingIntervalSeconds * 1000L
&& (currentTime - lastCheckTime) <= checkingIntervalSeconds * 1000L * 5
&& (!errorCounts.containsKey(name) || errorCounts.get(name) < 1);
}
@@ -78,7 +78,7 @@ public class StickyRandomDataSourceSelector extends RandomDataSourceSelector {
}
private boolean isExpired(StickyDataSourceHolder holder) {
return System.currentTimeMillis() - holder.getRetrievingTime() > expireSeconds * 1000;
return System.currentTimeMillis() - holder.getRetrievingTime() > expireSeconds * 1000L;
}
public int getExpireSeconds() {