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:50 UTC
svn commit: r1707684 - in /lucene/dev/branches/branch_5x: ./ lucene/
lucene/CHANGES.txt lucene/replicator/
lucene/replicator/src/java/org/apache/lucene/replicator/LocalReplicator.java
Author: mikemccand
Date: Fri Oct 9 09:39:50 2015
New Revision: 1707684
URL: http://svn.apache.org/viewvc?rev=1707684&view=rev
Log:
LUCENE-6823: use System.nanoTime for expiration in LocalReplicator
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/lucene/ (props changed)
lucene/dev/branches/branch_5x/lucene/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_5x/lucene/replicator/ (props changed)
lucene/dev/branches/branch_5x/lucene/replicator/src/java/org/apache/lucene/replicator/LocalReplicator.java
Modified: lucene/dev/branches/branch_5x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/CHANGES.txt?rev=1707684&r1=1707683&r2=1707684&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/lucene/CHANGES.txt Fri Oct 9 09:39:50 2015
@@ -122,6 +122,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/branches/branch_5x/lucene/replicator/src/java/org/apache/lucene/replicator/LocalReplicator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/replicator/src/java/org/apache/lucene/replicator/LocalReplicator.java?rev=1707684&r1=1707683&r2=1707684&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/replicator/src/java/org/apache/lucene/replicator/LocalReplicator.java (original)
+++ lucene/dev/branches/branch_5x/lucene/replicator/src/java/org/apache/lucene/replicator/LocalReplicator.java Fri Oct 9 09:39:50 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);
}
}