首页 > 代码库 > Mq测试
Mq测试
public class MqSubscriberTest extends Thread {
private Semaphore semaphore = new Semaphore(0);
ScheduledExecutorService service = Executors.newScheduledThreadPool(100);
MessageMqSubscriberRunnable listeningTask = null;
public static void main(String[] args) {
try {
MqSubscriberTest test = new MqSubscriberTest();
MessageMqSubscriberRunnable listeningTask = new MessageMqSubscriberRunnable();
test.service.schedule(listeningTask, 1, TimeUnit.SECONDS);
test.start();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} //启动服务器
}
public MqSubscriberTest() throws IOException {
//rverSocket = new ServerSocket(port);
System.out.println("ComServer Start");
}
public void run(){
try {
this.semaphore.acquire();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Mq测试