@Override public synchronized Instant getCommitTime() { if (commitTime==null) { //set commit time to current time commitTime = times.getTime(); } return commitTime; }
StandardTitanGraph graph = (StandardTitanGraph)g; TimestampProvider times = graph.getConfiguration().getTimestampProvider(); Instant end = times.getTime().plus(Duration.of(time,unit)); boolean isStable = false; while (times.getTime().isBefore(end)) { TitanManagement mgmt = graph.openManagement(); try { times.sleepFor(Duration.ofMillis(500)); } catch (InterruptedException e) {
public AbstractLocker(StaticBuffer rid, TimestampProvider times, ConsistentKeyLockerSerializer serializer, LocalLockMediator<StoreTransaction> llm, LockerState<S> lockState, Duration lockExpire, Logger log) { this.rid = rid; this.times = times; this.timeUnit = times.getUnit(); this.serializer = serializer; this.llm = llm; this.lockState = lockState; this.lockExpire = lockExpire; this.log = log; }
private WriteResult tryDeleteLockOnce(StaticBuffer key, StaticBuffer col, StoreTransaction txh) { Throwable t = null; final Timer delTimer = times.getTimer().start(); try { StoreTransaction newTx = overrideTimestamp(txh, delTimer.getStartTime()); store.mutate(key, ImmutableList.<Entry>of(), Arrays.asList(col), newTx); } catch (BackendException e) { t = e; } delTimer.stop(); return new WriteResult(delTimer.elapsed(), delTimer.getStartTime(), null, t); }
@Override protected void waitCondition() throws InterruptedException { if (lastInvocation!=null) times.sleepPast(lastInvocation.plus(CLEAN_SLEEP_TIME)); }
@Override public TimeUnit getNativeUnit() { return provider.getUnit(); }
StandardTitanGraph graph = (StandardTitanGraph)g; TimestampProvider times = graph.getConfiguration().getTimestampProvider(); Instant end = times.getTime().plus(Duration.of(time,unit)); boolean isStable = false; while (times.getTime().isBefore(end)) { TitanManagement mgmt = graph.openManagement(); try { times.sleepFor(Duration.ofMillis(500)); } catch (InterruptedException e) {
private WriteResult tryWriteLockOnce(StaticBuffer key, StaticBuffer del, StoreTransaction txh) { Throwable t = null; final Timer writeTimer = times.getTimer().start(); StaticBuffer newLockCol = serializer.toLockCol(writeTimer.getStartTime(), rid, times); Entry newLockEntry = StaticArrayEntry.of(newLockCol, zeroBuf); try { StoreTransaction newTx = overrideTimestamp(txh, writeTimer.getStartTime()); store.mutate(key, Arrays.asList(newLockEntry), null == del ? KeyColumnValueStore.NO_DELETIONS : Arrays.asList(del), newTx); } catch (BackendException e) { log.debug("Lock write attempt failed with exception", e); t = e; } writeTimer.stop(); return new WriteResult(writeTimer.elapsed(), writeTimer.getStartTime(), newLockCol, t); }
assert mustPass.getDeletionTime(times) < mustPass.getAdditionTime(times); try { times.sleepPast(mustPass.getAdditionTimeInstant(times)); } catch (InterruptedException e) { throw new PermanentBackendException("Unexpected interrupt", e);
/** * Returns the start time of this marker if such has been defined or the current time if not * @return */ public synchronized Instant getStartTime(TimestampProvider times) { if (startTime==null) { startTime = times.getTime(); } return startTime; }
/** * ################################### * Message Serialization & Utility * ################################### */ private int getTimeSlice(Timepoint timestamp) { long value = timestamp.getTimestamp(times.getUnit()) / TIMESLICE_INTERVAL; if (value>Integer.MAX_VALUE || value<0) throw new IllegalArgumentException("Timestamp overflow detected: " + timestamp); return (int)value; }