Package ghidra.util.worker
Class PriorityWorker
- java.lang.Object
-
- ghidra.util.worker.AbstractWorker<PriorityJob>
-
- ghidra.util.worker.PriorityWorker
-
public class PriorityWorker extends AbstractWorker<PriorityJob>
Executes a single job at a time in priority order.- See Also:
Worker
-
-
Constructor Summary
Constructors Constructor Description PriorityWorker(java.lang.String name, boolean isPersistentThread, boolean useSharedThreadPool, TaskMonitor monitor)
This constructor allows you to change persistence and shared thread pool usage.PriorityWorker(java.lang.String name, TaskMonitor monitor)
Creates a PriorityWorker that will use a shared thread pool to process jobs.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
schedule(PriorityJob job)
Schedules the job for execution.-
Methods inherited from class ghidra.util.worker.AbstractWorker
clearAllJobs, clearAllJobsWithInterrupt_IKnowTheRisks, clearPendingJobs, dispose, isBusy, isDisposed, setBusyListener, setTaskMonitor, waitUntilNoJobsScheduled
-
-
-
-
Constructor Detail
-
PriorityWorker
public PriorityWorker(java.lang.String name, TaskMonitor monitor)
Creates a PriorityWorker that will use a shared thread pool to process jobs. Also, threads created using this constructor are not persistent.- Parameters:
name
- the name of the shared thread pool.monitor
- the monitor used to cancel jobs.
-
PriorityWorker
public PriorityWorker(java.lang.String name, boolean isPersistentThread, boolean useSharedThreadPool, TaskMonitor monitor)
This constructor allows you to change persistence and shared thread pool usage.- Parameters:
name
- the name of the shared thread pool.isPersistentThread
- if true, the worker thread will stay around when idle; false means that the thread will go away if not needed. Should be true for high frequency usage.useSharedThreadPool
- true signals to use the given name to find/create a thread pool that can be shared throughout the system.monitor
- the monitor used to cancel jobs.
-
-
Method Detail
-
schedule
public void schedule(PriorityJob job)
Description copied from class:AbstractWorker
Schedules the job for execution. Jobs will be processed in priority order. The highest priority jobs are those with the lowest value return by the job's getPriority() method. (i.e. the job with priority 0 will be processed before the job with priority 1)- Overrides:
schedule
in classAbstractWorker<PriorityJob>
- Parameters:
job
- the job to be executed.
-
-