Created
December 3, 2017 18:00
-
-
Save chathurangat/b704bb2d1426a62f9de307872b2ced86 to your computer and use it in GitHub Desktop.
This file contains 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
class WorkerThread implements Runnable | |
{ | |
private String name; | |
private CountDownLatch countDownLatch; | |
WorkerThread(String name, CountDownLatch countDownLatch) | |
{ | |
this.name = name; | |
this.countDownLatch = countDownLatch; | |
} | |
@Override | |
public void run() | |
{ | |
try { | |
Thread.sleep(5000); | |
System.out.println(" thread [" + name + "] completed "); | |
countDownLatch.countDown(); | |
} catch (InterruptedException ex) { | |
System.out.println(" sleeping thread get interrupted "); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment