Skip to content

Instantly share code, notes, and snippets.

@chathurangat
Created December 3, 2017 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chathurangat/b704bb2d1426a62f9de307872b2ced86 to your computer and use it in GitHub Desktop.
Save chathurangat/b704bb2d1426a62f9de307872b2ced86 to your computer and use it in GitHub Desktop.
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