Interface JobScheduler

  • All Known Implementing Classes:
    ThreadPoolJobScheduler

    public interface JobScheduler
    A JobScheduler is responsible for receiving and scheduling job execution requests.
    • Method Detail

      • shutdown

        void shutdown()
        Stop scheduling jobs. This method may not return immediately, but wait for any outstanding jobs to be finished first.
      • start

        void start​(RequestEndpoint<?> requestEndpoint)
            throws Exception
        Start scheduling jobs listening on the given request endpoint.
        Throws:
        Exception - in case of startup failure
      • setInstanceName

        void setInstanceName​(String name)
        The scheduler's name (used for JMX naming purposes only)
        Parameters:
        name - the name of this JobScheduler instance
      • isRunning

        boolean isRunning()
        Return whether the scheduler is running.
        Returns:
        true iff the scheduler is running
      • awaitFreeCapacity

        void awaitFreeCapacity()
        Wait for free slots for the execution of jobs.
      • execute

        void execute​(ServerJob serverJob)
        Execute the given job.
        Parameters:
        serverJob - the ServerJob to execute
      • getActiveCount

        int getActiveCount()
        Get the number of currently active (executing) jobs.
        Returns:
        the number of executing jobss.
      • getInstanceName

        String getInstanceName()
        Returns:
        the name of this server instance.
      • getWorkingDirectory

        WorkingDirectory getWorkingDirectory()
        Get the working directory to be used for temporary files for this instance.
        Returns:
        the working directory that jobs should use
      • notifyStateChanged

        void notifyStateChanged​(ServerJob serverJob,
                                Job.State state)
        Notifies informally the Job Scheduler that the viewer side's Job.State of a ServerJob has changed. No mission critical component must rely on this information.
        Parameters:
        serverJob - The job that has changed the state
        state - the new state