Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f23f66f

Browse files
Aseem JainAseem Jain
Aseem Jain
authored and
Aseem Jain
committed
Java Thread Pool
added description
1 parent dee828d commit f23f66f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

‎src/javaConcepts/threadpool/SimpleThreadPool.java‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33
import java.util.concurrent.ExecutorService;
44
import java.util.concurrent.Executors;
55

6+
/**
7+
* Java Thread Pool
8+
* Java Thread pool represents a group of worker threads that are waiting for the job and reuse many times.
9+
*
10+
* In case of thread pool, a group of fixed size threads are created. A thread from the thread pool is pulled out and assigned a job by the service provider. After completion of the job, thread is contained in the thread pool again.
11+
*
12+
* Advantage of Java Thread Pool
13+
* Better performance It saves time because there is no need to create new thread.
14+
*
15+
* Real time usage
16+
* It is used in Servlet and JSP where container creates a thread pool to process the request.
17+
*/
18+
619
class WorkerThread implements Runnable {
720
private String message;
821
public WorkerThread(String s){
@@ -36,4 +49,5 @@ public static void main(String[] args) {
3649
System.out.println("Finished all threads");
3750
}
3851

39-
}
52+
}
53+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /