Details
Description
{code}
private boolean pastReconnThreshold() {
long currentTime = System.nanoTime();
if (currentTime - thresholdLastCheck > 100000000) { //if longer than 10 sec
configThresholdCount = 0; // it's been more than 10 sec since last
// tried, so don't try again just yet.
}
configThresholdCount++;
thresholdLastCheck = currentTime;
if (configThresholdCount >= maxConfigCheck) {
return true;
}
return false;
}
{code}
Does the above really work as expected? It looks strange. 100000000 in nanos is only 100 millis and not 10 seconds as stated in comments.
If there is more than 100 millis between calls we always reset configThresholdCount and will never return true, which seems very strange.
private boolean pastReconnThreshold() {
long currentTime = System.nanoTime();
if (currentTime - thresholdLastCheck > 100000000) { //if longer than 10 sec
configThresholdCount = 0; // it's been more than 10 sec since last
// tried, so don't try again just yet.
}
configThresholdCount++;
thresholdLastCheck = currentTime;
if (configThresholdCount >= maxConfigCheck) {
return true;
}
return false;
}
{code}
Does the above really work as expected? It looks strange. 100000000 in nanos is only 100 millis and not 10 seconds as stated in comments.
If there is more than 100 millis between calls we always reset configThresholdCount and will never return true, which seems very strange.
Activity
Michael Nitschinger
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Assignee | Michael Nitschinger [ daschl ] | Matt Ingenthron [ ingenthr ] |
Michael Nitschinger
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Fix Version/s | 1.1beta [ 10370 ] | |
| Resolution | Fixed [ 1 ] |