Class Scheduler.Null

  • All Implemented Interfaces:
    Scheduler
    Enclosing interface:
    Scheduler

    public static class Scheduler.Null
    extends java.lang.Object
    implements Scheduler
    • Constructor Summary

      Constructors 
      Constructor Description
      Null()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cancelJob​(Job job)
      Cancel a job, making the scheduler forget it completely..
      void close()
      Shut down the scheduler, calling close() on the underlying Selector.
      long currentTimeMillis()
      Return the scheduler's idea of the current time.
      void installJob​(Job job, long deadline)
      Install a job with only an associated deadline (removing any channel association)
      void installJob​(Job job, long deadline, java.nio.channels.SelectableChannel channel, int interest)
      Install a job in association with a channel and an interest set.
      boolean isClosed()
      Return true if the scheduler is closing or closed.
      java.util.Set<Job> junitGetAllJobs()
      Return all jobs known to the scheduler, in whatever state.
      java.util.ArrayList<java.nio.channels.SelectionKey> junitGetAllKeys()
      Return the selection keys currently known to the scheduler.
      java.util.Map<java.nio.channels.SelectableChannel,​Job> junitGetChannelsAndJobs()
      Return a map containing all channels and the jobs to which they are associated.
      java.util.ArrayList<java.nio.channels.SelectionKey> junitGetReadyKeys()
      Return the selection keys currently known to the scheduler.
      java.nio.channels.Selector junitGetSelector()
      Return a reference to the selector
      java.util.ArrayList<Job> junitGetTimeoutQueue()
      Return the contents of the timeout queue, in deadline order
      boolean junitTestTimeoutQueueInvariant()
      Return true if the timeout queue invariant holds.
      boolean work​(long timeout, io.deephaven.base.Procedure.Nullary handoff)
      Wait for jobs to become ready, then invoke() them all.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Null

        public Null()
    • Method Detail

      • currentTimeMillis

        public long currentTimeMillis()
        Description copied from interface: Scheduler
        Return the scheduler's idea of the current time.
        Specified by:
        currentTimeMillis in interface Scheduler
      • installJob

        public void installJob​(Job job,
                               long deadline,
                               java.nio.channels.SelectableChannel channel,
                               int interest)
        Description copied from interface: Scheduler
        Install a job in association with a channel and an interest set.
        Specified by:
        installJob in interface Scheduler
      • installJob

        public void installJob​(Job job,
                               long deadline)
        Description copied from interface: Scheduler
        Install a job with only an associated deadline (removing any channel association)
        Specified by:
        installJob in interface Scheduler
      • cancelJob

        public void cancelJob​(Job job)
        Description copied from interface: Scheduler
        Cancel a job, making the scheduler forget it completely..
        Specified by:
        cancelJob in interface Scheduler
      • work

        public boolean work​(long timeout,
                            io.deephaven.base.Procedure.Nullary handoff)
        Description copied from interface: Scheduler
        Wait for jobs to become ready, then invoke() them all. This method will form the core of the main loop of a scheduler-driven application. The method first waits until: -- the given timeout expires, -- the earliest job-specific timeout expires, or -- one or more jobs becomes ready If jobs have become ready, then the entire ready set will be invoked. If any job throws an uncaught exception, the job's terminated() method will be called and the job deregistered. This does not abort the invocation of the remaining jobs. The return value is then the number of jobs that were invoked. If no jobs are ready and any job-specific timeouts expire, the associated jobs' timedOut() methods are called. The return value is the negative of the number of expired timeouts. If the time given by the timeout argument expires, then zero is returned. Note that this method is not synchronized. The application must ensure that it is never called concurrently by more than one thread.
        Specified by:
        work in interface Scheduler
        Returns:
        true, if some job was dispatched
      • close

        public void close()
        Description copied from interface: Scheduler
        Shut down the scheduler, calling close() on the underlying Selector.
        Specified by:
        close in interface Scheduler
      • isClosed

        public boolean isClosed()
        Description copied from interface: Scheduler
        Return true if the scheduler is closing or closed.
        Specified by:
        isClosed in interface Scheduler
      • junitGetSelector

        public java.nio.channels.Selector junitGetSelector()
        Description copied from interface: Scheduler
        Return a reference to the selector
        Specified by:
        junitGetSelector in interface Scheduler
      • junitGetAllJobs

        public java.util.Set<Job> junitGetAllJobs()
        Description copied from interface: Scheduler
        Return all jobs known to the scheduler, in whatever state.
        Specified by:
        junitGetAllJobs in interface Scheduler
      • junitGetTimeoutQueue

        public java.util.ArrayList<Job> junitGetTimeoutQueue()
        Description copied from interface: Scheduler
        Return the contents of the timeout queue, in deadline order
        Specified by:
        junitGetTimeoutQueue in interface Scheduler
        Returns:
        the jobs in the timeout queue
      • junitGetAllKeys

        public java.util.ArrayList<java.nio.channels.SelectionKey> junitGetAllKeys()
        Description copied from interface: Scheduler
        Return the selection keys currently known to the scheduler.
        Specified by:
        junitGetAllKeys in interface Scheduler
      • junitGetReadyKeys

        public java.util.ArrayList<java.nio.channels.SelectionKey> junitGetReadyKeys()
        Description copied from interface: Scheduler
        Return the selection keys currently known to the scheduler.
        Specified by:
        junitGetReadyKeys in interface Scheduler
      • junitGetChannelsAndJobs

        public java.util.Map<java.nio.channels.SelectableChannel,​Job> junitGetChannelsAndJobs()
        Description copied from interface: Scheduler
        Return a map containing all channels and the jobs to which they are associated.
        Specified by:
        junitGetChannelsAndJobs in interface Scheduler
      • junitTestTimeoutQueueInvariant

        public boolean junitTestTimeoutQueueInvariant()
        Description copied from interface: Scheduler
        Return true if the timeout queue invariant holds.
        Specified by:
        junitTestTimeoutQueueInvariant in interface Scheduler