Fix API change and add javadoc.

This commit is contained in:
Andrzej Bialecki 2018-05-21 12:26:31 +02:00
parent 7c8fdcd1b6
commit 93926e9c83
2 changed files with 17 additions and 5 deletions

View File

@ -45,6 +45,12 @@ public class ActionThrottleTest extends SolrTestCaseJ4 {
return getTimeNs();
}
@Override
public long[] getTimeAndEpochNs() {
long time = getTimeNs();
return new long[]{time, time};
}
@Override
public void sleep(long ms) throws InterruptedException {
throw new UnsupportedOperationException();

View File

@ -52,7 +52,7 @@ public abstract class TimeSource {
}
@Override
long[] getTimeAndEpochNs() {
public long[] getTimeAndEpochNs() {
long time = getTimeNs();
return new long[] {time, time};
}
@ -94,7 +94,7 @@ public abstract class TimeSource {
}
@Override
long[] getTimeAndEpochNs() {
public long[] getTimeAndEpochNs() {
long time = getTimeNs();
return new long[] {time, epochStart + time - nanoStart};
}
@ -138,7 +138,7 @@ public abstract class TimeSource {
}
@Override
long[] getTimeAndEpochNs() {
public long[] getTimeAndEpochNs() {
long time = getTimeNs();
return new long[] {time, epochStart + time - nanoStart};
}
@ -216,8 +216,14 @@ public abstract class TimeSource {
*/
public abstract long getEpochTimeNs();
// for unit testing
abstract long[] getTimeAndEpochNs();
/**
* Return both the source's time value and the corresponding epoch time
* value. This method ensures that epoch time calculations use the same internal
* value of time as that reported by {@link #getTimeNs()}.
* @return an array where the first element is {@link #getTimeNs()} and the
* second element is {@link #getEpochTimeNs()}.
*/
public abstract long[] getTimeAndEpochNs();
/**
* Sleep according to this source's notion of time. Eg. accelerated time source such as