Permalink
Browse files

Merge branch 'nanotime-lock' of https://github.com/ash2k/astyanax int…

…o ash2k-nanotime-lock
  • Loading branch information...
2 parents a20aab8 + 5afcbce commit e51608baa2ea4e174fed46a47063a1f74424a9dd @sagarl sagarl committed Feb 13, 2014
@@ -248,7 +248,7 @@ public void acquire() throws Exception {
m.execute();
verifyLock(curTimeMicros);
- acquireTime = System.currentTimeMillis();
+ acquireTime = System.nanoTime();
return;
}
catch (BusyLockException e) {
@@ -325,7 +325,7 @@ public void releaseWithMutation(MutationBatch m) throws Exception {
}
public boolean releaseWithMutation(MutationBatch m, boolean force) throws Exception {
- long elapsed = System.currentTimeMillis() - acquireTime;
+ long elapsed = TimeUnit.MILLISECONDS.convert(System.nanoTime() - acquireTime, TimeUnit.NANOSECONDS);
boolean isStale = false;
if (timeout > 0 && elapsed > TimeUnit.MILLISECONDS.convert(timeout, this.timeoutUnits)) {
isStale = true;

0 comments on commit e51608b

Please sign in to comment.