@Test public void testSetMessageListener() throws JMSException { JmsPoolConnection connection = (JmsPoolConnection) cf.createQueueConnection(); Session session = connection.createSession(); Queue queue = session.createTemporaryQueue(); MessageConsumer consumer = session.createConsumer(queue); MessageListener listener = new MessageListener() { @Override public void onMessage(Message message) { } }; assertNull(consumer.getMessageListener()); consumer.setMessageListener(listener); assertNotNull(consumer.getMessageListener()); assertEquals(listener, consumer.getMessageListener()); consumer.close(); try { consumer.setMessageListener(null); fail("Should not be able to interact with closed consumer"); } catch (IllegalStateException ise) {} try { consumer.getMessageListener(); fail("Should not be able to interact with closed consumer"); } catch (IllegalStateException ise) {} }
@Override public void setMessageListener(MessageListener listener) throws JMSException { checkClosed(); messageConsumer.setMessageListener(listener); }
JmsPoolMessageConsumer implements MessageConsumer, AutoCloseable { @Override public void setMessageListener(MessageListener listener) throws JMSException { checkClosed(); messageConsumer.setMessageListener(listener); } }
JmsPoolMessageConsumer implements MessageConsumer, AutoCloseable { @Override public void setMessageListener(MessageListener listener) throws JMSException { checkClosed(); messageConsumer.setMessageListener(listener); } JmsPoolMessageConsumer(JmsPoolSession session, MessageConsumer messageConsumer); }
JmsPoolMessageConsumer implements MessageConsumer, AutoCloseable { @Override public void setMessageListener(MessageListener listener) throws JMSException { checkClosed(); messageConsumer.setMessageListener(listener); } JmsPoolMessageConsumer(JmsPoolSession session, MessageConsumer messageConsumer); @Override void close(); @Override MessageListener getMessageListener(); @Override String getMessageSelector(); @Override Message receive(); @Override Message receive(long timeout); @Override Message receiveNoWait(); @Override void setMessageListener(MessageListener listener); @Override String toString(); MessageConsumer getMessageConsumer(); }
JmsPoolMessageConsumer implements MessageConsumer, AutoCloseable { @Override public void setMessageListener(MessageListener listener) throws JMSException { checkClosed(); messageConsumer.setMessageListener(listener); } JmsPoolMessageConsumer(JmsPoolSession session, MessageConsumer messageConsumer); @Override void close(); @Override MessageListener getMessageListener(); @Override String getMessageSelector(); @Override Message receive(); @Override Message receive(long timeout); @Override Message receiveNoWait(); @Override void setMessageListener(MessageListener listener); @Override String toString(); MessageConsumer getMessageConsumer();  }