You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/javaConcepts/threadpool/SimpleThreadPool.java
+15-1Lines changed: 15 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,19 @@
3
3
importjava.util.concurrent.ExecutorService;
4
4
importjava.util.concurrent.Executors;
5
5
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
+
6
19
classWorkerThreadimplementsRunnable {
7
20
privateStringmessage;
8
21
publicWorkerThread(Strings){
@@ -36,4 +49,5 @@ public static void main(String[] args) {
0 commit comments