public String toString() { TemporalUnit u = times.getUnit(); if (start==null) return "Initialized"; if (stop==null) return String.format("Started at %d %s",times.getTime(start),u); return String.format("%d %s", times.getTime(stop) - times.getTime(start), u); } }
": lock timestamp " + tr.getTimestamp() + " " + times.getUnit() + " is older than " + ConfigElement.getPath(GraphDatabaseConfiguration.LOCK_EXPIRE) + "=" + lockExpire);
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; }
@Override public TimeUnit getNativeUnit() { return provider.getUnit(); }
/** * ################################### * 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; }
public String toString() { TimeUnit u = times.getUnit(); if (start==null) return "Initialized"; if (stop==null) return String.format("Started at %d %s",start.getNativeTimestamp(),u); return String.format("%d %s", stop.getNativeTimestamp() - start.getNativeTimestamp(), u); } }
public String toString() { TemporalUnit u = times.getUnit(); if (start==null) return "Initialized"; if (stop==null) return String.format("Started at %d %s",times.getTime(start),u); return String.format("%d %s", times.getTime(stop) - times.getTime(start), u); } }
private Duration timeSinceFirstMsg() { Duration sinceFirst = ZeroDuration.INSTANCE; if (!toSend.isEmpty()) { Timepoint firstTimestamp = toSend.get(0).message.getMessage().getTimestampMicro(); Timepoint nowTimestamp = times.getTime(); if (firstTimestamp.compareTo(nowTimestamp) < 0) { long firstRaw = firstTimestamp.getTimestamp(times.getUnit()); long nowRaw = nowTimestamp.getTimestamp(times.getUnit()); assert firstRaw < nowRaw; sinceFirst = new StandardDuration(nowRaw - firstRaw, times.getUnit()); } } return sinceFirst; }
public Duration elapsed() { if (null == start) { return ZeroDuration.INSTANCE; } final Timepoint stopTime = (null==stop? times.getTime() : stop); return new StandardDuration(stopTime.getNativeTimestamp() - start.getNativeTimestamp(), times.getUnit()); }
private Entry writeMessage(KCVSMessage msg) { StaticBuffer content = msg.getContent(); DataOutput out = manager.serializer.getDataOutput(8 + 8 + manager.senderId.length() + 2 + content.length()); final long rawTimestamp = msg.getTimestamp(times.getUnit()); Preconditions.checkArgument(rawTimestamp>0); out.putLong(rawTimestamp); out.writeObjectNotNull(manager.senderId); out.putLong(numMsgCounter.incrementAndGet()); final int valuePos = out.getPosition(); out.putBytes(content); return new StaticArrayEntry(out.getStaticBuffer(),valuePos); }
@Override public void read(Message message) { ReadBuffer content = message.getContent().asReadBuffer(); String senderId = message.getSenderId(); TransactionLogHeader.Entry txentry = TransactionLogHeader.parse(content,serializer,times); TransactionLogHeader txheader = txentry.getHeader(); StandardTransactionId transactionId = new StandardTransactionId(senderId,txheader.getId(), new Timestamp(txheader.getTimestamp(times.getUnit()),times.getUnit())); TxEntry entry; try { entry = txCache.get(transactionId,entryFactory); } catch (ExecutionException e) { throw new AssertionError("Unexpected exception",e); } entry.update(txentry); }
rm.add(columnFamily, e.getColumnAs(StaticBuffer.BB_FACTORY), e.getValueAs(StaticBuffer.BB_FACTORY), commitTime.getAdditionTime(times.getUnit()), ttl); } else { rm.add(columnFamily, e.getColumnAs(StaticBuffer.BB_FACTORY), e.getValueAs(StaticBuffer.BB_FACTORY), commitTime.getAdditionTime(times.getUnit())); rm.delete(columnFamily, col.as(StaticBuffer.BB_FACTORY), commitTime.getDeletionTime(times.getUnit()));
if (delta / 3 > readLagTime.getLength(times.getUnit())) { log.warn("MessagePuller configured with ReadMarker timestamp in the improbably distant future: {} (current time is {})", messageTimeStart, currentTime); } else { Preconditions.checkState(times.getUnit().equals(messageTimeStart.getNativeUnit()), "Expected TimestampProvider TimeUnit %s to match nextTimepoint unit %s", times.getUnit(), messageTimeStart.getNativeUnit()); Preconditions.checkState(times.getUnit().equals(messageTimeEnd.getNativeUnit()), "Expected Timestampprovider TimeUnit %s to match timeWindowEnd unit %s", times.getUnit(), messageTimeStart.getNativeUnit());
sp.addToColumn_names(buf.as(StaticBuffer.BB_FACTORY)); d.setPredicate(sp); d.setTimestamp(commitTime.getDeletionTime(times.getUnit())); org.apache.cassandra.thrift.Mutation m = new org.apache.cassandra.thrift.Mutation(); m.setDeletion(d); column.setValue(ent.getValueAs(StaticBuffer.BB_FACTORY)); column.setTimestamp(commitTime.getAdditionTime(times.getUnit()));
": lock timestamp " + tr.getTimestamp() + " " + times.getUnit() + " is older than " + ConfigElement.getPath(GraphDatabaseConfiguration.LOCK_EXPIRE) + "=" + lockExpire);
Long time = r.getPropertyDirect(this); if (time==null) return null; //there is no timestamp TimeUnit unit = r.tx().getConfiguration().getTimestampProvider().getUnit(); return (O) new Timestamp(time, unit);