/** Connects to a named queue. */ public JMSQueue(ConnectionFactory connectionFactory, Destination queue) throws Exception { _connection = connectionFactory.createConnection(); _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE); if (queue == null) _destination = _session.createTemporaryQueue(); else _destination = queue; _consumer = _session.createConsumer(_destination); _producer = _session.createProducer(_destination); _connection.start(); }
protected void finalize() { try { _connection.close(); } catch (JMSException e) { // intentionally left empty } }