Skip to content

Instantly share code, notes, and snippets.

@visparashar
Created September 10, 2017 15:43
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 visparashar/6856291f74a2e326b07669c0b3a806f0 to your computer and use it in GitHub Desktop.
Save visparashar/6856291f74a2e326b07669c0b3a806f0 to your computer and use it in GitHub Desktop.
Main Class
package com.vp.activemq;
import com.vp.activemq.consumer.HelloWorldConsumer;
import com.vp.activemq.producer.HelloWorldProducer;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args ) throws InterruptedException
{
thread(new HelloWorldProducer(),false);
thread(new HelloWorldProducer(),false);
thread(new HelloWorldProducer(),false);
thread(new HelloWorldProducer(),false);
thread(new HelloWorldProducer(),false);
thread(new HelloWorldProducer(),false);
thread(new HelloWorldProducer(),false);
thread(new HelloWorldProducer(),false);
thread(new HelloWorldProducer(),false);
Thread.sleep(1000);
thread(new HelloWorldConsumer(),false);
thread(new HelloWorldConsumer(),false);
thread(new HelloWorldConsumer(),false);
thread(new HelloWorldConsumer(),false);
thread(new HelloWorldConsumer(),false);
thread(new HelloWorldConsumer(),false);
thread(new HelloWorldConsumer(),false);
thread(new HelloWorldConsumer(),false);
thread(new HelloWorldConsumer(),false);
}
public static void thread(Runnable run , boolean flag){
Thread blockThread = new Thread(run);
blockThread.setDaemon(flag);
blockThread.start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment