[ https://issues.apache.org/jira/browse/ARTEMIS-2520?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Domenico Bruscino closed ARTEMIS-2520. -------------------------------------- Resolution: Not A Bug > Consumer.receive return null if server is stopped > ------------------------------------------------- > > Key: ARTEMIS-2520 > URL: https://issues.apache.org/jira/browse/ARTEMIS-2520 > Project: ActiveMQ Artemis > Issue Type: Improvement > Reporter: Domenico Bruscino > Priority: Minor > > ActiveMQMessageConsumer.receive(timeout) returns null, if the server is > stopped during the call. > Test to reproduce: > {code:java} > ConnectionFactory factorySend = new ActiveMQConnectionFactory(); > Connection connection = factorySend.createConnection(); > try (Session session = connection.createSession()) { > javax.jms.Queue queue = session.createQueue("queueStop"); > MessageProducer producer = session.createProducer(queue); > producer.send(session.createTextMessage("text")); > connection.start(); > MessageConsumer consumer = session.createConsumer(queue); > assertNotNull(consumer.receive(1000)); > final CountDownLatch stoppingLatch = new CountDownLatch(1); > (new Thread(new Runnable() { > @Override > public void run() { > try { > stoppingLatch.countDown(); > Thread.sleep(1000); > server.stop(); > } catch (Exception e) { > e.printStackTrace(); > } > } > })).start(); > try { > stoppingLatch.await(); > consumer.receive(5000); > Assert.fail("didn't get expected exception!"); > } catch (Exception e) { > e.printStackTrace(); > } > } > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)