org.encog.util.concurrency
public class EngineConcurrency extends Object implements MultiThreadable
Constructor and Description |
---|
EngineConcurrency()
Construct a concurrency object.
|
Modifier and Type | Method and Description |
---|---|
void |
checkError()
Check to see if one of the threads has thrown an error.
|
TaskGroup |
createTaskGroup()
Create a new task group.
|
static EngineConcurrency |
getInstance() |
int |
getThreadCount() |
void |
processTask(EngineTask task)
Process the specified task.
|
void |
processTask(EngineTask task,
TaskGroup group)
Process the specified task.
|
void |
registerError(Throwable t)
Allows threads to register errors, these errors will be thrown by the
main thread.
|
void |
setThreadCount(int t)
Set the number of threads to use.
|
void |
shutdown(long timeout)
Wait for all threads in the pool to complete.
|
public static EngineConcurrency getInstance()
public void setThreadCount(int t)
setThreadCount
in interface MultiThreadable
t
- The number of threads to use, or zero to
automatically determine based on core count.public void checkError()
public TaskGroup createTaskGroup()
public void processTask(EngineTask task)
task
- The task to process.public void processTask(EngineTask task, TaskGroup group)
task
- The task to process.group
- The task group.public void registerError(Throwable t)
t
- The error to register.public void shutdown(long timeout)
timeout
- How long to wait for all threads to complete.public int getThreadCount()
getThreadCount
in interface MultiThreadable
Copyright © 2014. All Rights Reserved.