org.encog.util.concurrency.job
Class ConcurrentJob
- java.lang.Object
-
- org.encog.util.concurrency.job.ConcurrentJob
-
- All Implemented Interfaces:
- java.lang.Runnable, MultiThreadable
- Direct Known Subclasses:
- PruneIncremental
public abstract class ConcurrentJob extends java.lang.Object implements java.lang.Runnable, MultiThreadable
This class forms the basis for a job that can be run concurrently.
-
-
Constructor Summary
Constructors Constructor and Description ConcurrentJob(StatusReportable report)Construct a concurrent job.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description booleangetShouldStop()intgetThreadCount()booleanisRunning()abstract intloadWorkload()Load the subtasks.abstract voidperformJobUnit(JobUnitContext context)Perform one job unit.voidprocess()Process the job.voidprocessBackground()voidreportStatus(JobUnitContext context, java.lang.String status)Report the status for this job.abstract java.lang.ObjectrequestNextTask()Request the next task to be processed.voidrun()voidsetReport(StatusReportable r)voidsetThreadCount(int numThreads)Set the number of threads to use.voidstop()Request the process to stop.
-
-
-
Constructor Detail
-
ConcurrentJob
public ConcurrentJob(StatusReportable report)
Construct a concurrent job.- Parameters:
report- The object to report status to.
-
-
Method Detail
-
loadWorkload
public abstract int loadWorkload()
Load the subtasks.- Returns:
- The total number of subtasks.
-
performJobUnit
public abstract void performJobUnit(JobUnitContext context)
Perform one job unit.- Parameters:
context- The context for the job unit.
-
process
public void process()
Process the job.
-
processBackground
public void processBackground()
-
reportStatus
public void reportStatus(JobUnitContext context, java.lang.String status)
Report the status for this job.- Parameters:
context- The job context.status- The status to report.
-
requestNextTask
public abstract java.lang.Object requestNextTask()
Request the next task to be processed.- Returns:
- The next task to be processed.
-
getShouldStop
public boolean getShouldStop()
- Returns:
- True if the process should stop.
-
stop
public void stop()
Request the process to stop.
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
isRunning
public boolean isRunning()
- Returns:
- the running
-
setReport
public void setReport(StatusReportable r)
-
getThreadCount
public int getThreadCount()
- Specified by:
getThreadCountin interfaceMultiThreadable- Returns:
- The number of threads to use, 0 to automatically determine based on core count.
-
setThreadCount
public void setThreadCount(int numThreads)
Set the number of threads to use.- Specified by:
setThreadCountin interfaceMultiThreadable- Parameters:
numThreads- The number of threads to use, or zero to automatically determine based on core count.
-
-
DMelt 3.0 © DataMelt by jWork.ORG