session.commit();
      public void run()      {         try         {            synchronized (semaphore)            {               semaphore.wait();            }            int counter = 0;            while (!shouldStop)            {               log.trace("Producer ID=" + id + " send message");               producer.send(session.createTextMessage("Message from producer " + id + " counter=" + (counter)));               synchronized (lockWriter)               {                  messageCounterProducer++;               }               if (counter++ % 5 == 0)               {                  //log.info("Committing message");                  session.commit();               }            }         }         catch (Exception e)         {            log.info("Caught exception... finishing Thread " + id, e);         }      }