You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Domenico Bruscino (Jira)" <ji...@apache.org> on 2019/10/14 13:19:00 UTC
[jira] [Created] (ARTEMIS-2520) Consumer.receive return null if
server is stopped
Domenico Bruscino created ARTEMIS-2520:
------------------------------------------
Summary: 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: Bug
Reporter: Domenico Bruscino
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)