public void disconnect() throws JMSException { if (connection != null) { messageProducer.close(); connection.stop(); connection.close(); System.out.println("disconnect"); } }