Class SchedulerContext

java.lang.Object
io.trino.execution.executor.scheduler.SchedulerContext

@NotThreadSafe public final class SchedulerContext extends Object
  • Constructor Details

    • SchedulerContext

      public SchedulerContext(FairScheduler scheduler, io.trino.execution.executor.scheduler.TaskControl handle)
  • Method Details

    • maybeYield

      public boolean maybeYield()
      Attempt to relinquish control to let other tasks run.
      Returns:
      false if the task was interrupted or cancelled while yielding, for example if the Java thread was interrupted, the scheduler was shutdown, or the scheduling group was removed. The caller is expected to clean up and finish.
    • block

      public boolean block(com.google.common.util.concurrent.ListenableFuture<?> future)
      Indicate that the current task is blocked. The method returns when the future completes of it the task is interrupted.
      Returns:
      false if the task was interrupted or cancelled while blocked, for example if the Java thread was interrupted, the scheduler was shutdown, or the scheduling group was removed. The caller is expected to clean up and finish.
    • getStartNanos

      public long getStartNanos()
    • getWaitNanos

      public long getWaitNanos()
    • getScheduledNanos

      public long getScheduledNanos()
    • getBlockedNanos

      public long getBlockedNanos()