MCPcopy Create free account
hub / github.com/grpc/grpc-java / runOnExpiration

Method runOnExpiration

api/src/context/java/io/grpc/Deadline.java:195–199  ·  view source on GitHub ↗

Schedule a task to be run when the deadline expires. Note if this deadline was created with a custom Ticker, the scheduler's underlying clock should be synchronized with that Ticker. Otherwise the task won't be run at the expected point of time. @param task to run on expiration

(Runnable task, ScheduledExecutorService scheduler)

Source from the content-addressed store, hash-verified

193 * @return {@link ScheduledFuture} which can be used to cancel execution of the task
194 */
195 public ScheduledFuture<?> runOnExpiration(Runnable task, ScheduledExecutorService scheduler) {
196 requireNonNull(task, "task");
197 requireNonNull(scheduler, "scheduler");
198 return scheduler.schedule(task, deadlineNanos - ticker.nanoTime(), TimeUnit.NANOSECONDS);
199 }
200
201 @Override
202 public String toString() {

Calls 2

scheduleMethod · 0.65
nanoTimeMethod · 0.65