#107 Thread Pool JavaDoc

This commit is contained in:
Ilkka Seppala 2015-08-21 23:23:01 +03:00
parent fde7f71704
commit 0bda2bda1e
3 changed files with 14 additions and 4 deletions

View File

@ -13,14 +13,19 @@ import java.util.concurrent.Executors;
* more tasks than threads. As soon as a thread completes its task, it will request the next * more tasks than threads. As soon as a thread completes its task, it will request the next
* task from the queue until all tasks have been completed. The thread can then terminate, or * task from the queue until all tasks have been completed. The thread can then terminate, or
* sleep until there are new tasks available. * sleep until there are new tasks available.
* * <p>
* In this example we create a list of tasks presenting work to be done. Each task is then * In this example we create a list of tasks presenting work to be done. Each task is then
* wrapped into a Worker object that implements Runnable. We create an ExecutorService with * wrapped into a {@link Worker} object that implements {@link Runnable}. We create an
* fixed number of threads (Thread Pool) and use them to execute the Workers. * {@link ExecutorService} with fixed number of threads (Thread Pool) and use them to execute
* the {@link Worker}s.
* *
*/ */
public class App { public class App {
/**
* Program entry point
* @param args command line args
*/
public static void main( String[] args ) { public static void main( String[] args ) {
System.out.println("Program started"); System.out.println("Program started");

View File

@ -2,7 +2,7 @@ package com.iluwatar.threadpool;
/** /**
* *
* Worker implements Runnable and thus can be executed by ExecutorService * Worker implements {@link Runnable} and thus can be executed by {@link ExecutorService}
* *
*/ */
public class Worker implements Runnable { public class Worker implements Runnable {

View File

@ -4,6 +4,11 @@ import org.junit.Test;
import com.iluwatar.threadpool.App; import com.iluwatar.threadpool.App;
/**
* Application test
* @author ilkka
*
*/
public class AppTest { public class AppTest {
@Test @Test