public void recordHeartbeat() { lastHeartbeat.set(DateTime.now()); }
public void startProcessTimer() { if (startNanos.compareAndSet(0, System.nanoTime())) { pipelineContext.start(); executionStartTime.set(DateTime.now()); } }
public void start() { DateTime now = DateTime.now(); executionStartTime.compareAndSet(null, now); // always update last execution start time lastExecutionStartTime.set(now); taskContext.start(); }
public synchronized boolean transitionToScheduled() { schedulingComplete.compareAndSet(null, DateTime.now()); return stageState.setIf(SCHEDULED, currentState -> currentState == PLANNED || currentState == SCHEDULING || currentState == SCHEDULING_SPLITS); }
public void finished() { if (!finished.compareAndSet(false, true)) { // already finished return; } executionEndTime.set(DateTime.now()); endNanos.set(System.nanoTime()); pipelineContext.driverFinished(this); }
public static DateTime nowUtc() { return DateTime.now(ISOChronology.getInstanceUTC()); }
/** * For each request, the addPage method will be called zero or more times, * followed by either requestComplete or clientFinished (if buffer complete). If the client is * closed, requestComplete or bufferFinished may never be called. * <p/> * <b>NOTE:</b> Implementations of this interface are not allowed to perform * blocking operations. */ public interface ClientCallback { boolean addPages(HttpPageBufferClient client, List<SerializedPage> pages); void requestComplete(HttpPageBufferClient client); void clientFinished(HttpPageBufferClient client); void clientFailed(HttpPageBufferClient client, Throwable cause); }
@Override public IndexRange createUnknownRange(String index) { final DateTime begin = new DateTime(0L, DateTimeZone.UTC); final DateTime end = new DateTime(0L, DateTimeZone.UTC); final DateTime now = DateTime.now(DateTimeZone.UTC); return MongoIndexRange.create(index, begin, end, now, 0); }
public void start() { DateTime now = DateTime.now(); executionStartTime.compareAndSet(null, now); startNanos.compareAndSet(0, System.nanoTime()); startFullGcCount.compareAndSet(-1, gcMonitor.getMajorGcCount()); startFullGcTimeNanos.compareAndSet(-1, gcMonitor.getMajorGcTime().roundTo(NANOSECONDS)); // always update last execution start time lastExecutionStartTime.set(now); }
@Override public void onSuccess(@Nullable StatusResponse result) { checkNotHoldsLock(this); backoff.success(); synchronized (HttpPageBufferClient.this) { closed = true; if (future == resultFuture) { future = null; } lastUpdate = DateTime.now(); } requestsCompleted.incrementAndGet(); clientCallback.clientFinished(HttpPageBufferClient.this); }
@Override public boolean test(Sidecar sidecar) { final DateTime threshold = DateTime.now(DateTimeZone.UTC).minus(timeoutPeriod); return sidecar.lastSeen().isAfter(threshold); } }
private synchronized void initiateRequest() { scheduled = false; if (closed || (future != null)) { return; } if (completed) { sendDelete(); } else { sendGetResults(); } lastUpdate = DateTime.now(); }
private boolean isAbandoned(T query) { DateTime oldestAllowedHeartbeat = DateTime.now().minus(clientTimeout.toMillis()); DateTime lastHeartbeat = query.getLastHeartbeat(); return lastHeartbeat != null && lastHeartbeat.isBefore(oldestAllowedHeartbeat); }
public static ClusterEvent create(@NotEmpty String producer, @NotEmpty String eventClass, @NotEmpty Object payload) { return create(null, DateTime.now(DateTimeZone.UTC).getMillis(), producer, Collections.<String>emptySet(), eventClass, payload); } }
public static TaskInfo createInitialTask(TaskId taskId, URI location, String nodeId, List<BufferInfo> bufferStates, TaskStats taskStats) { return new TaskInfo( initialTaskStatus(taskId, location, nodeId), DateTime.now(), new OutputBufferInfo("UNINITIALIZED", OPEN, true, true, 0, 0, 0, 0, bufferStates), ImmutableSet.of(), taskStats, true); }
/** * Perform a sanity check to make sure that the year is reasonably current, to guard against * issues in third party libraries. */ public static void verifySystemTimeIsReasonable() { int currentYear = DateTime.now().year().get(); if (currentYear < 2019) { failRequirement("Presto requires the system time to be current (found year %s)", currentYear); } }
private static boolean isLeaked(Map<QueryId, BasicQueryInfo> queryIdToInfo, QueryId queryId) { BasicQueryInfo queryInfo = queryIdToInfo.get(queryId); if (queryInfo == null) { return true; } DateTime queryEndTime = queryInfo.getQueryStats().getEndTime(); if (queryInfo.getState() == RUNNING || queryEndTime == null) { return false; } return secondsBetween(queryEndTime, now()).getSeconds() >= DEFAULT_LEAK_CLAIM_DELTA_SEC; }
@Test public void fromMethodNameTwoPathVariables() { DateTime now = DateTime.now(); UriComponents uriComponents = fromMethodName( ControllerWithMethods.class, "methodWithTwoPathVariables", 1, now).build(); assertThat(uriComponents.getPath(), is("/something/1/foo/" + ISODateTimeFormat.date().print(now))); }
@Test public void testSerialization() throws Exception { Interval interval = new Interval(DateTime.now(DateTimeZone.UTC), DateTime.now(DateTimeZone.UTC)); String version = "someversion"; CustomVersioningPolicy policy = new CustomVersioningPolicy(version); CustomVersioningPolicy serialized = ServerTestHelper.MAPPER.readValue( ServerTestHelper.MAPPER.writeValueAsBytes(policy), CustomVersioningPolicy.class ); Assert.assertEquals(version, policy.getVersion(interval)); Assert.assertEquals(version, serialized.getVersion(interval)); } }
private TaskStats getTaskStats(TaskHolder taskHolder) { TaskInfo finalTaskInfo = taskHolder.getFinalTaskInfo(); if (finalTaskInfo != null) { return finalTaskInfo.getStats(); } SqlTaskExecution taskExecution = taskHolder.getTaskExecution(); if (taskExecution != null) { return taskExecution.getTaskContext().getTaskStats(); } // if the task completed without creation, set end time DateTime endTime = taskStateMachine.getState().isDone() ? DateTime.now() : null; return new TaskStats(taskStateMachine.getCreatedTime(), endTime); }