Created
July 22, 2026 15:14
-
-
Save HackMEAny/3245397367e400c78599a682fbcc5276 to your computer and use it in GitHub Desktop.
Debugging Multi-threaded Java Applications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ani_test; | |
| import java.util.concurrent.Executor; | |
| import java.util.concurrent.ExecutorService; | |
| import java.util.concurrent.Executors; | |
| class executer implements Runnable { | |
| int id = 0; | |
| executer(int id) { | |
| System.out.println("Inside Executer -->>"); | |
| this.id = id; | |
| } | |
| @Override | |
| public void run() { | |
| Thread.currentThread().setName("D3f4ult_" + id); | |
| System.out.println("EXECUTER HIT id = " + this.id); | |
| } | |
| } | |
| public class InterThread { | |
| public static void main(String[] args) { | |
| ExecutorService aa = Executors.newFixedThreadPool(5); | |
| for (int i = 0; i < 5; i++) { | |
| aa.execute(new executer(i)); | |
| } | |
| aa.shutdown(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment