Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
P
PP-02-ExecutorService
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mohamadbashar.disoki
PP-02-ExecutorService
Commits
d889e054
You need to sign in or sign up before continuing.
Commit
d889e054
authored
Nov 01, 2023
by
Mohamad Bashar Desoki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Executor Service
parent
19f2877a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
ExecutorServiceFixed.java
src/main/java/ExecutorServiceFixed.java
+23
-0
No files found.
src/main/java/ExecutorServiceFixed.java
0 → 100644
View file @
d889e054
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
public
class
ExecutorServiceFixed
{
public
static
void
main
(
String
arg
[]){
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
3
);
for
(
int
i
=
0
;
i
<
20
;
i
++)
{
executorService
.
execute
(
newRunnable
(
" "
+
i
));
}
executorService
.
shutdown
();
}
private
static
Runnable
newRunnable
(
String
msg
){
return
new
Runnable
()
{
@Override
public
void
run
()
{
String
report
=
Thread
.
currentThread
().
getName
()+
" :"
+
msg
;
System
.
out
.
println
(
report
);
}
};
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment