Class ThreadPoolJobScheduler

  • All Implemented Interfaces:
    JobScheduler, ThreadFactory, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.jmx.export.naming.SelfNaming

    @ManagedResource(description="A job scheduler")
    public class ThreadPoolJobScheduler
    extends Object
    implements JobScheduler, ThreadFactory, org.springframework.jmx.export.naming.SelfNaming, org.springframework.context.ApplicationContextAware
    A default implementation of the JobScheduler interface which schedules and executes jobs using a ThreadPoolExecutor.
    • Field Detail

      • shutdownRequested

        protected boolean shutdownRequested
    • Method Detail

      • setConcurrentJobs

        public void setConcurrentJobs​(int size)
      • setConcurrentJobsPerProcessor

        public void setConcurrentJobsPerProcessor​(int n)
      • isApplicationContextShutdownActive

        public boolean isApplicationContextShutdownActive()
      • setApplicationContextShutdownActive

        public void setApplicationContextShutdownActive​(boolean applicationContextShutdownActive)
      • shutdown

        public void shutdown()
        Description copied from interface: JobScheduler
        Stop scheduling jobs. This method may not return immediately, but wait for any outstanding jobs to be finished first.
        Specified by:
        shutdown in interface JobScheduler
      • getActiveCount

        @ManagedAttribute(description="Number of actively executing jobs")
        public int getActiveCount()
        Description copied from interface: JobScheduler
        Get the number of currently active (executing) jobs.
        Specified by:
        getActiveCount in interface JobScheduler
        Returns:
        the number of executing jobss.
      • getCompletedTaskCount

        @ManagedAttribute(description="Number of completed jobs")
        public long getCompletedTaskCount()
      • getMaximumPoolSize

        @ManagedAttribute(description="Maximum number of concurrently executing jobs")
        public int getMaximumPoolSize()
      • getCorePoolSize

        @ManagedAttribute(description="Number of idle threads in the pool")
        public int getCorePoolSize()
      • getThreadPriority

        @ManagedAttribute(description="Priority for executor threads")
        public int getThreadPriority()
      • setThreadPriority

        public void setThreadPriority​(int threadPriority)
      • setInstanceName

        public void setInstanceName​(String name)
        Description copied from interface: JobScheduler
        The scheduler's name (used for JMX naming purposes only)
        Specified by:
        setInstanceName in interface JobScheduler
        Parameters:
        name - the name of this JobScheduler instance
      • isRunning

        @ManagedAttribute
        public boolean isRunning()
        Description copied from interface: JobScheduler
        Return whether the scheduler is running.
        Specified by:
        isRunning in interface JobScheduler
        Returns:
        true iff the scheduler is running
      • awaitFreeCapacity

        public void awaitFreeCapacity()
        Description copied from interface: JobScheduler
        Wait for free slots for the execution of jobs.
        Specified by:
        awaitFreeCapacity in interface JobScheduler
      • notifyStateChanged

        public void notifyStateChanged​(ServerJob serverJob,
                                       Job.State state)
        Description copied from interface: JobScheduler
        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.
        Specified by:
        notifyStateChanged in interface JobScheduler
        Parameters:
        serverJob - The job that has changed the state
        state - the new state
      • setTempFileReaper

        public void setTempFileReaper​(TempFileReaper tempFileReaper)
      • setNodeWorkerFactory

        public void setNodeWorkerFactory​(NodeWorkerFactory workerFactory)
      • setStatisticsRecorder

        public void setStatisticsRecorder​(ServerStatistics statistics)
      • setExecutionStrategyFactory

        public void setExecutionStrategyFactory​(ExecutionStrategyFactory executionTypeFactory)
      • getWorkingDirectory

        public WorkingDirectory getWorkingDirectory()
        Description copied from interface: JobScheduler
        Get the working directory to be used for temporary files for this instance.
        Specified by:
        getWorkingDirectory in interface JobScheduler
        Returns:
        the working directory that jobs should use
      • setWorkingDirectory

        public void setWorkingDirectory​(WorkingDirectory workingDirectory)
      • setApplicationContext

        public void setApplicationContext​(org.springframework.context.ApplicationContext applicationContext)
        Specified by:
        setApplicationContext in interface org.springframework.context.ApplicationContextAware