list.add(new LocalThreadProducer(i, conn.createSession(true, Session.AUTO_ACKNOWLEDGE), queue[1])); list.add(new LocalThreadConsumer(i, conn.createSession(true, Session.AUTO_ACKNOWLEDGE), queue[1]));
list.add(new LocalThreadProducer(i, conn.createSession(false, Session.AUTO_ACKNOWLEDGE), queue[1])); list.add(new LocalThreadConsumer(i, conn.createSession(false, Session.AUTO_ACKNOWLEDGE), queue[1]));
   public void testMultiThreadFailover() throws Exception   {      JBossConnectionFactory factory = (JBossConnectionFactory) ic[1].lookup("/ConnectionFactory");      Connection conn = factory.createConnection();      conn.start();      ArrayList list = new ArrayList();      for (int i = 0; i < 5; i++)      {         list.add(new LocalThreadProducer(i, conn.createSession(true, Session.AUTO_ACKNOWLEDGE), queue[1]));         list.add(new LocalThreadConsumer(i, conn.createSession(true, Session.AUTO_ACKNOWLEDGE), queue[1]));      }      for (Iterator iter = list.iterator(); iter.hasNext();)      {         Thread t = (Thread) iter.next();         t.start();      }      Thread.sleep(1000);      synchronized (semaphore)      {         semaphore.notifyAll();      }      Thread.sleep(30000);      log.info("Killing server 1");      ServerManagement.kill(1);      Thread.sleep(50000);      shouldStop=true;      for (Iterator iter = list.iterator(); iter.hasNext();)      {         Thread t = (Thread) iter.next();         t.join();      }      log.info("produced " + messageCounterProducer + " and read " + messageCounterConsumer);      assertEquals(messageCounterProducer, messageCounterConsumer);   }