Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class mqDirect {
- public static void main (String args[]) throws Exception
- {
- int parallelism = 2;
- ExecutorService executorService =
- Executors.newFixedThreadPool(parallelism);
- Semaphore semaphore = new Semaphore(parallelism);
- for (int i = 0; i < 1; i ++) {
- try {
- semaphore.acquire();
- // snip ... do stuff..
- semaphore.release();
- catch(Throwable throwable) {
- semaphore.release();
- }
- executorService.shutdownNow();
- }}
Add Comment
Please, Sign In to add comment