You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2018/05/21 10:27:12 UTC

lucene-solr:master: Fix API change and add javadoc.

Repository: lucene-solr
Updated Branches:
  refs/heads/master 7c8fdcd1b -> 93926e9c8


Fix API change and add javadoc.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/93926e9c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/93926e9c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/93926e9c

Branch: refs/heads/master
Commit: 93926e9c83a9b4e9d52182654befae9d56191911
Parents: 7c8fdcd
Author: Andrzej Bialecki <ab...@apache.org>
Authored: Mon May 21 12:26:31 2018 +0200
Committer: Andrzej Bialecki <ab...@apache.org>
Committed: Mon May 21 12:26:31 2018 +0200

----------------------------------------------------------------------
 .../org/apache/solr/cloud/ActionThrottleTest.java   |  6 ++++++
 .../org/apache/solr/common/util/TimeSource.java     | 16 +++++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/93926e9c/solr/core/src/test/org/apache/solr/cloud/ActionThrottleTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/ActionThrottleTest.java b/solr/core/src/test/org/apache/solr/cloud/ActionThrottleTest.java
index f904a98..d277e31 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ActionThrottleTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ActionThrottleTest.java
@@ -46,6 +46,12 @@ public class ActionThrottleTest extends SolrTestCaseJ4 {
     }
 
     @Override
+    public long[] getTimeAndEpochNs() {
+      long time = getTimeNs();
+      return new long[]{time, time};
+    }
+
+    @Override
     public void sleep(long ms) throws InterruptedException {
       throw new UnsupportedOperationException();
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/93926e9c/solr/solrj/src/java/org/apache/solr/common/util/TimeSource.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/TimeSource.java b/solr/solrj/src/java/org/apache/solr/common/util/TimeSource.java
index 69aa40f..ac8749d 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/TimeSource.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/TimeSource.java
@@ -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