public ReliableTopicMessage(Data payload, Address publisherAddress) { this.publishTime = Clock.currentTimeMillis(); this.publisherAddress = publisherAddress; this.payload = payload; }
TopicEvent(String name, Data data, Address publisherAddress) { this.name = name; this.publishTime = Clock.currentTimeMillis(); this.publisherAddress = publisherAddress; this.data = data; }
TopicEvent(String name, Data data, Address publisherAddress) { this.name = name; this.publishTime = Clock.currentTimeMillis(); this.publisherAddress = publisherAddress; this.data = data; }
public ReliableTopicMessage(Data payload, Address publisherAddress) { this.publishTime = Clock.currentTimeMillis(); this.publisherAddress = publisherAddress; this.payload = payload; }
@Override public void begin() throws IllegalStateException { if (state == ACTIVE) { throw new IllegalStateException("Transaction is already active"); } startTime = Clock.currentTimeMillis(); state = ACTIVE; }
@Override public void begin() throws IllegalStateException { if (state == ACTIVE) { throw new IllegalStateException("Transaction is already active"); } startTime = Clock.currentTimeMillis(); state = ACTIVE; }
public LocalOperationStatsImpl() { this.maxVisibleSlowOperationCount = Long.MAX_VALUE; this.slowOperations = new ArrayList<SlowOperationDTO>(); this.creationTime = Clock.currentTimeMillis(); }
private boolean isSyncComputation(boolean preventSync) { long now = Clock.currentTimeMillis(); long last = lastSubmitTime; lastSubmitTime = now; AtomicInteger consecutiveSubmits = this.consecutiveSubmits; if (last + MIN_TIME_RESOLUTION_OF_CONSECUTIVE_SUBMITS < now) { consecutiveSubmits.set(0); return false; } return !preventSync && consecutiveSubmits.incrementAndGet() % MAX_CONSECUTIVE_SUBMITS == 0; }
void reset() { clusterServiceLock.lock(); try { joinInProgress = false; joiningMembers.clear(); timeToStartJoin = Clock.currentTimeMillis() + waitMillisBeforeJoin; firstJoinRequest = 0; } finally { clusterServiceLock.unlock(); } }
/** * Marks start of new repartitioning. * Resets stats from previous repartitioning round. */ void markNewRepartition() { lastRepartitionTime.set(Clock.currentTimeMillis()); elapsedMigrationOperationTime.set(0); elapsedDestinationCommitTime.set(0); elapsedMigrationTime.set(0); completedMigrations.set(0); }
/** * Calculate and set the cluster clock diff. * * @param masterTime the cluster clock timestamp sent by the master node */ public void setMasterTime(long masterTime) { long diff = masterTime - Clock.currentTimeMillis(); setClusterTimeDiff(diff); }
private void checkTimeout() throws TransactionException { if (startTime + timeoutMillis < currentTimeMillis()) { throw new TransactionException("Transaction is timed-out!"); } }
@Override public boolean awaitUntil(Date deadline) throws InterruptedException { long until = deadline.getTime(); final long durationMs = until - Clock.currentTimeMillis(); if (durationMs <= 0) { return false; } return await(durationMs, TimeUnit.MILLISECONDS); }
@Override public void memberAdded(MembershipEvent membershipEvent) { // initialize heartbeat for newly-joined members long now = Clock.currentTimeMillis(); lastHeartbeatReceived.put(membershipEvent.getMember(), now); }
private long getExpirationTimeMs(BlockingOperation blockingOperation) { long waitTimeout = blockingOperation.getWaitTimeout(); if (waitTimeout < 0) { return -1; } long expirationTime = Clock.currentTimeMillis() + waitTimeout; if (expirationTime < 0) { return -1; } return expirationTime; }
@Probe @Override public long getClusterUpTime() { return Clock.currentTimeMillis() - clusterStartTime; }
@Override public int getAdjustedTTLSeconds(int ttl) { if (ttl <= TextCommandConstants.getMonthSeconds()) { return ttl; } else { return ttl - (int) (TimeUnit.MILLISECONDS.toSeconds(Clock.currentTimeMillis())); } }
@Override public boolean awaitUntil(Date deadline) throws InterruptedException { long until = deadline.getTime(); long durationMs = until - Clock.currentTimeMillis(); if (durationMs <= 0) { return false; } return await(durationMs, TimeUnit.MILLISECONDS); }
private Object newOperationTimeoutException(Throwable e) { StringBuilder sb = new StringBuilder(); sb.append(this); sb.append(" timed out because exception occurred after client invocation timeout "); sb.append(invocationService.getInvocationTimeoutMillis()).append(" ms. "); sb.append("Current time: ").append(timeToString(currentTimeMillis())).append(". "); sb.append("Start time: ").append(timeToString(startTimeMillis)).append(". "); sb.append("Total elapsed time: ").append(currentTimeMillis() - startTimeMillis).append(" ms. "); String msg = sb.toString(); return new OperationTimeoutException(msg, e); }
@Override public boolean contains(Data key) { long now = Clock.currentTimeMillis(); R record = records.get(key); boolean isExpired = processExpiredEntry(key, record, now); return record != null && !isExpired; }