Class LocalJobRunner<T extends Job>

    • Field Detail

      • m_NumThreads

        protected int m_NumThreads
        the number of threads to use.
      • m_MetaData

        protected Map<String,​Object> m_MetaData
        optional meta-data.
      • m_Jobs

        protected List<T extends Job> m_Jobs
        all the jobs.
      • m_Queue

        protected List<T extends Job> m_Queue
        stores Jobs. add to job queue when dependencies complete.
    • Constructor Detail

      • LocalJobRunner

        public LocalJobRunner()
    • Method Detail

      • setNumThreads

        public void setNumThreads​(int value)
        Sets the number of threads to use.
        Specified by:
        setNumThreads in interface ThreadLimiter
        Parameters:
        value - the number of threads
      • getNumThreads

        public int getNumThreads()
        Returns the number of threads being used for execution.
        Specified by:
        getNumThreads in interface ThreadLimiter
        Returns:
        the number of threads
      • numThreadsTipText

        public String numThreadsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getQuickInfo

        public String getQuickInfo()
        Returns a quick info about the object, which can be displayed in the GUI.
        Specified by:
        getQuickInfo in interface QuickInfoSupporter
        Returns:
        null if no info available, otherwise short string
      • notifyJobCompleteListeners

        protected void notifyJobCompleteListeners​(JobCompleteEvent e)
        Notifies all listeners with the given event.
        Parameters:
        e - the event to send to the listeners
      • clear

        public void clear()
        Clears all jobs, but not the meta-data.
        Specified by:
        clear in interface JobRunner<T extends Job>
      • add

        public void add​(T job)
        Adds the job to the execution queue.
        Specified by:
        add in interface JobRunner<T extends Job>
        Parameters:
        job - the job to add
      • add

        public void add​(JobList<T> jobs)
        Adds the jobs to the execution queue.
        Specified by:
        add in interface JobRunner<T extends Job>
        Parameters:
        jobs - the jobs to add
      • getJobs

        public List<T> getJobs()
        Returns the list of all jobs.
        Specified by:
        getJobs in interface JobRunner<T extends Job>
        Returns:
        the jobs
      • getMetaData

        public Map<String,​Object> getMetaData()
        Returns the meta-data.
        Returns:
        the meta-data
      • enqueue

        protected boolean enqueue()
        Enqueues any jobs still waiting in the queue in the executor service.
        Returns:
        true if jobs were queued
      • preStart

        protected String preStart()
        Before actual start up.
        Overrides:
        preStart in class AbstractJobRunner<T extends Job>
        Returns:
        null if successful, otherwise error message
      • doStop

        protected String doStop()
        Stops the execution after all currently queued jobs have been executed.
        Specified by:
        doStop in class AbstractJobRunner<T extends Job>
        Returns:
        null if successful, otherwise error message
      • doTerminate

        protected String doTerminate​(boolean wait)
        Performing actual terminate up.
        Specified by:
        doTerminate in class AbstractJobRunner<T extends Job>
        Parameters:
        wait - whether to wait for the jobs to finish
        Returns:
        null if successful, otherwise error message
      • waitForComplete

        protected void waitForComplete()
        Wait until Jobs are completed.
      • complete

        public void complete​(T j,
                             JobResult jr)
        Job is complete, so check for more to add..
        Specified by:
        complete in interface JobRunner<T extends Job>
        Parameters:
        j - job
        jr - job result