You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2015/10/09 11:39:12 UTC
svn commit: r1707683 - in /lucene/dev/trunk/lucene: CHANGES.txt
replicator/src/java/org/apache/lucene/replicator/LocalReplicator.java
Author: mikemccand
Date: Fri Oct 9 09:39:12 2015
New Revision: 1707683
URL: http://svn.apache.org/viewvc?rev=1707683&view=rev
Log:
LUCENE-6823: use System.nanoTime for expiration in LocalReplicator
Modified:
lucene/dev/trunk/lucene/CHANGES.txt
lucene/dev/trunk/lucene/replicator/src/java/org/apache/lucene/replicator/LocalReplicator.java
Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1707683&r1=1707682&r2=1707683&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Fri Oct 9 09:39:12 2015
@@ -177,6 +177,10 @@ Bug Fixes
terms because they were filtered out by e.g. a FilterCodecReader
(Trejkaz via Mike McCandless)
+* LUCENE-6823: LocalReplicator should use System.nanoTime as its clock
+ source for checking for expiration (Ishan Chattopadhyaya via Mike
+ McCandless)
+
Other
* LUCENE-6827: Use explicit capacity ArrayList instead of a LinkedList
Modified: lucene/dev/trunk/lucene/replicator/src/java/org/apache/lucene/replicator/LocalReplicator.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/replicator/src/java/org/apache/lucene/replicator/LocalReplicator.java?rev=1707683&r1=1707682&r2=1707683&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/replicator/src/java/org/apache/lucene/replicator/LocalReplicator.java (original)
+++ lucene/dev/trunk/lucene/replicator/src/java/org/apache/lucene/replicator/LocalReplicator.java Fri Oct 9 09:39:12 2015
@@ -22,6 +22,7 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.lucene.store.AlreadyClosedException;
@@ -87,15 +88,16 @@ public class LocalReplicator implements
ReplicationSession(SessionToken session, RefCountedRevision revision) {
this.session = session;
this.revision = revision;
- lastAccessTime = System.currentTimeMillis();
+ lastAccessTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
}
boolean isExpired(long expirationThreshold) {
- return lastAccessTime < (System.currentTimeMillis() - expirationThreshold);
+ return lastAccessTime < (TimeUnit.MILLISECONDS.convert(System.nanoTime(),
+ TimeUnit.NANOSECONDS) - expirationThreshold);
}
void markAccessed() {
- lastAccessTime = System.currentTimeMillis();
+ lastAccessTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
}
}