use of com.thinkaurelius.titan.diskstorage.util.time.Timepoint in project incubator-atlas by apache.
the class HBaseKeyColumnValueStore method acquireLock.
@Override
public void acquireLock(StaticBuffer key, StaticBuffer column, StaticBuffer expectedValue, StoreTransaction txh) throws BackendException {
KeyColumn lockID = new KeyColumn(key, column);
logger.debug("Attempting to acquireLock on {} ", lockID);
int trialCount = 0;
boolean locked;
while (trialCount < lockMaxRetries) {
final Timepoint lockStartTime = Timestamps.MILLI.getTime(System.currentTimeMillis(), TimeUnit.MILLISECONDS);
locked = localLockMediator.lock(lockID, txh, lockStartTime.add(lockExpiryTimeMs));
trialCount++;
if (!locked) {
handleLockFailure(txh, lockID, trialCount);
} else {
logger.debug("Acquired lock on {}, {}", lockID, txh);
break;
}
}
((HBaseTransaction) txh).updateLocks(lockID, expectedValue);
}