@Test
public void testResourceCycle() throws InterruptedException{

  CountDownLatch fire = new CountDownLatch(1);
  CountDownLatch notifier = new CountDownLatch(1);
  CountDownLatch interrupter = new CountDownLatch(1);
  Thread t0 = new NotifyGetter(fire, notifier, interrupter, queue), 
              t1 =new NotifyGetter(fire, notifier, interrupter, queue),
              t2=new NotifyGetter(fire, notifier, interrupter, queue);
  
  long tid0 = t0.getId(),tid1 = t1.getId(),tid2=t2.getId();
  
  synchronized(queue){
    queue.addByThreadId(generateOprationById(0), tid0);
    queue.addByThreadId(generateOprationById(3), tid1);
    queue.addByThreadId(generateOprationById(2), tid2);
    queue.addByThreadId(generateOprationById(1), tid0);
    queue.addByThreadId(generateOprationById(1), tid1);
    queue.addByThreadId(generateOprationById(1), tid2);
    queue.addByThreadId(generateOprationById(2), tid1);
    queue.addByThreadId(generateOprationById(3), tid2);
  }
    t0.setName("t0");
    t1.setName("t1");
    t2.setName("t2");
    t0.start();
    t1.start();
    t2.start();
    //wait enough time to T0 lock successfully and T1 and T2 trying lock
    Thread.sleep(3000);
    interrupter.countDown();
    Thread.sleep(3000);
    fire.countDown();
    t0.join();
    t1.join();
    t2.join();
}