public class ThreadPool extends Object
FunctionToExec and the input is a unique file where each
line is an input to be processed. Each thread pulls a line and
process it, then writes the output on a individual or shared file.FunctionToExec| Constructor and Description |
|---|
ThreadPool(int nThreads,
String inputFile,
FunctionToExec function)
Creates the thread pull.
|
| Modifier and Type | Method and Description |
|---|---|
ThreadPool |
flush()
Performs the flush everytime a thread writes something (for debugging)
|
void |
run()
Starts the threads.
|
ThreadPool |
setOutputFile(String file)
Sets the output file name.
|
ThreadPool |
setOutputFolder(String folder)
Sets the output folder.
|
ThreadPool |
setThreadSleepTime(long millis)
Sets thread sleep time
|
ThreadPool |
useOnlyOneOutputFile()
Uses only one output file.
|
public ThreadPool(int nThreads,
String inputFile,
FunctionToExec function)
nThreads - number of thread to use.inputFile - the input file, each line is an input for a thread.function - the action that each thread has to perform.public ThreadPool flush()
public ThreadPool useOnlyOneOutputFile()
public ThreadPool setThreadSleepTime(long millis)
public ThreadPool setOutputFolder(String folder)
folder - the output folderpublic ThreadPool setOutputFile(String file)
file - the output filepublic void run()
Copyright © 2013. All rights reserved.