Sorry all but I didn’t know where to post this,
I have a threadpool and I want to run a threadpooltest, but when I compile the threadpooltest it says it cannot recognise the fullstop between “out” and “printIn”
Here’s the code:
public class ThreadPoolTest {
public static void main(String[] args) {
if (args.length != 2) {
System.out.printIn("Tests the ThreadPool task.");
System.out.printIn(
"Usage: java ThreadPoolTest numTasks numThreads");
System.out.printIn(
" numTasks - integer: number of tasks to run.");
System.out.printIn(
" numThreads - integer: number of threads " +
"in the thread pool.");
return;
}
int numTasks = Integer.parseInt(args[0]);
int numThreads = Integer.parseInt(args[1]);
//create the thread pool
ThreadPool ThreadPool = new ThreadPool (numThreads);
// run example tasks
for (int i=0; i<numTasks; i++) {
ThreadPool.runTask(createTask(i));
}
// closes the pool and wait for all tasks to finish
ThreadPool.join();
}
/**
Creates a simple Runnable that prints an ID, waits 500
milliseconds, then prints the ID again.
*/
private static Runnable createTask(final int taskID) {
return new Runnable() {
public void run() {
System.out.printIn("Task " + taskID + ": start");
// simulate a long running task
try {
Thread.sleep(500);
}
catch (InterruptedException ex) {}
System.out.printIn("Task " + taskID + ": end");
}
};
}
}
If anyone can help it would be much appreciated.
Cheers,
Hauk