mirror of https://github.com/apache/activemq.git
need to call free on the amqp resources now to ensure their state data is all cleaned up.
This commit is contained in:
parent
1abc95b6a4
commit
3afde7bac7
|
@ -32,6 +32,7 @@ import javax.jms.InvalidSelectorException;
|
||||||
import org.apache.activemq.command.ActiveMQDestination;
|
import org.apache.activemq.command.ActiveMQDestination;
|
||||||
import org.apache.activemq.command.ActiveMQMessage;
|
import org.apache.activemq.command.ActiveMQMessage;
|
||||||
import org.apache.activemq.command.ActiveMQTempQueue;
|
import org.apache.activemq.command.ActiveMQTempQueue;
|
||||||
|
import org.apache.activemq.command.ActiveMQTempTopic;
|
||||||
import org.apache.activemq.command.Command;
|
import org.apache.activemq.command.Command;
|
||||||
import org.apache.activemq.command.ConnectionError;
|
import org.apache.activemq.command.ConnectionError;
|
||||||
import org.apache.activemq.command.ConnectionId;
|
import org.apache.activemq.command.ConnectionId;
|
||||||
|
@ -53,7 +54,6 @@ import org.apache.activemq.command.SessionId;
|
||||||
import org.apache.activemq.command.SessionInfo;
|
import org.apache.activemq.command.SessionInfo;
|
||||||
import org.apache.activemq.command.ShutdownInfo;
|
import org.apache.activemq.command.ShutdownInfo;
|
||||||
import org.apache.activemq.command.TransactionInfo;
|
import org.apache.activemq.command.TransactionInfo;
|
||||||
import org.apache.activemq.command.ActiveMQTempTopic;
|
|
||||||
import org.apache.activemq.selector.SelectorParser;
|
import org.apache.activemq.selector.SelectorParser;
|
||||||
import org.apache.activemq.util.IOExceptionSupport;
|
import org.apache.activemq.util.IOExceptionSupport;
|
||||||
import org.apache.activemq.util.IdGenerator;
|
import org.apache.activemq.util.IdGenerator;
|
||||||
|
@ -83,7 +83,6 @@ import org.apache.qpid.proton.engine.Connection;
|
||||||
import org.apache.qpid.proton.engine.Delivery;
|
import org.apache.qpid.proton.engine.Delivery;
|
||||||
import org.apache.qpid.proton.engine.EndpointState;
|
import org.apache.qpid.proton.engine.EndpointState;
|
||||||
import org.apache.qpid.proton.engine.Event;
|
import org.apache.qpid.proton.engine.Event;
|
||||||
import org.apache.qpid.proton.engine.Event.Type.*;
|
|
||||||
import org.apache.qpid.proton.engine.Link;
|
import org.apache.qpid.proton.engine.Link;
|
||||||
import org.apache.qpid.proton.engine.Receiver;
|
import org.apache.qpid.proton.engine.Receiver;
|
||||||
import org.apache.qpid.proton.engine.Sasl;
|
import org.apache.qpid.proton.engine.Sasl;
|
||||||
|
@ -310,6 +309,7 @@ class AmqpProtocolConverter implements IAmqpProtocolConverter {
|
||||||
} else if (remoteState == EndpointState.CLOSED) {
|
} else if (remoteState == EndpointState.CLOSED) {
|
||||||
((AmqpDeliveryListener) link.getContext()).onClose();
|
((AmqpDeliveryListener) link.getContext()).onClose();
|
||||||
link.close();
|
link.close();
|
||||||
|
link.free();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,6 +481,7 @@ class AmqpProtocolConverter implements IAmqpProtocolConverter {
|
||||||
session.setContext(null);
|
session.setContext(null);
|
||||||
}
|
}
|
||||||
session.close();
|
session.close();
|
||||||
|
session.free();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onLinkOpen(Link link) {
|
private void onLinkOpen(Link link) {
|
||||||
|
|
|
@ -46,11 +46,9 @@ import org.apache.activemq.broker.jmx.ConnectorViewMBean;
|
||||||
import org.apache.activemq.broker.jmx.QueueViewMBean;
|
import org.apache.activemq.broker.jmx.QueueViewMBean;
|
||||||
import org.apache.activemq.transport.amqp.joram.ActiveMQAdmin;
|
import org.apache.activemq.transport.amqp.joram.ActiveMQAdmin;
|
||||||
import org.apache.activemq.util.Wait;
|
import org.apache.activemq.util.Wait;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.objectweb.jtests.jms.framework.TestConfig;
|
import org.objectweb.jtests.jms.framework.TestConfig;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -284,7 +282,7 @@ public class JMSClientTest extends JMSClientTestSupport {
|
||||||
assertEquals("hello + 9", ((TextMessage) msg).getText());
|
assertEquals("hello + 9", ((TextMessage) msg).getText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class Testable implements Runnable {
|
abstract class Testable implements Runnable {
|
||||||
protected String msg;
|
protected String msg;
|
||||||
synchronized boolean passed() {
|
synchronized boolean passed() {
|
||||||
|
@ -307,8 +305,9 @@ public class JMSClientTest extends JMSClientTestSupport {
|
||||||
producer.setDeliveryMode(DeliveryMode.PERSISTENT);
|
producer.setDeliveryMode(DeliveryMode.PERSISTENT);
|
||||||
|
|
||||||
final Message m = session.createTextMessage("Sample text");
|
final Message m = session.createTextMessage("Sample text");
|
||||||
|
|
||||||
Testable t = new Testable() {
|
Testable t = new Testable() {
|
||||||
|
@Override
|
||||||
public synchronized void run() {
|
public synchronized void run() {
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < 30; ++i) {
|
for (int i = 0; i < 30; ++i) {
|
||||||
|
@ -329,7 +328,7 @@ public class JMSClientTest extends JMSClientTestSupport {
|
||||||
//wait until we know that the producer was able to send a message
|
//wait until we know that the producer was able to send a message
|
||||||
producer.wait(10000);
|
producer.wait(10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
stopBroker();
|
stopBroker();
|
||||||
assertTrue(t.passed());
|
assertTrue(t.passed());
|
||||||
}
|
}
|
||||||
|
@ -341,8 +340,9 @@ public class JMSClientTest extends JMSClientTestSupport {
|
||||||
final Queue queue = session.createQueue(getDestinationName());
|
final Queue queue = session.createQueue(getDestinationName());
|
||||||
connection.start();
|
connection.start();
|
||||||
|
|
||||||
|
|
||||||
Testable t = new Testable() {
|
Testable t = new Testable() {
|
||||||
|
@Override
|
||||||
public synchronized void run() {
|
public synchronized void run() {
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
|
@ -400,6 +400,7 @@ public class JMSClientTest extends JMSClientTestSupport {
|
||||||
|
|
||||||
final MessageConsumer consumer=session.createConsumer(queue);
|
final MessageConsumer consumer=session.createConsumer(queue);
|
||||||
Testable t = new Testable() {
|
Testable t = new Testable() {
|
||||||
|
@Override
|
||||||
public synchronized void run() {
|
public synchronized void run() {
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
|
@ -414,7 +415,7 @@ public class JMSClientTest extends JMSClientTestSupport {
|
||||||
LOG.info("Caught exception on receiveNoWait: {}", ex);
|
LOG.info("Caught exception on receiveNoWait: {}", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
synchronized (consumer) {
|
synchronized (consumer) {
|
||||||
new Thread(t).start();
|
new Thread(t).start();
|
||||||
|
@ -433,6 +434,7 @@ public class JMSClientTest extends JMSClientTestSupport {
|
||||||
|
|
||||||
final MessageConsumer consumer=session.createConsumer(queue);
|
final MessageConsumer consumer=session.createConsumer(queue);
|
||||||
Testable t = new Testable() {
|
Testable t = new Testable() {
|
||||||
|
@Override
|
||||||
public synchronized void run() {
|
public synchronized void run() {
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
|
@ -464,8 +466,9 @@ public class JMSClientTest extends JMSClientTestSupport {
|
||||||
connection.start();
|
connection.start();
|
||||||
|
|
||||||
final MessageConsumer consumer=session.createConsumer(queue);
|
final MessageConsumer consumer=session.createConsumer(queue);
|
||||||
|
|
||||||
Testable t = new Testable() {
|
Testable t = new Testable() {
|
||||||
|
@Override
|
||||||
public synchronized void run() {
|
public synchronized void run() {
|
||||||
try {
|
try {
|
||||||
Message m = consumer.receive(1);
|
Message m = consumer.receive(1);
|
||||||
|
@ -747,7 +750,7 @@ public class JMSClientTest extends JMSClientTestSupport {
|
||||||
s.createTemporaryQueue().delete();
|
s.createTemporaryQueue().delete();
|
||||||
|
|
||||||
stopBroker();
|
stopBroker();
|
||||||
|
|
||||||
assertTrue("No exception listener event fired.", called.await(15, TimeUnit.SECONDS));
|
assertTrue("No exception listener event fired.", called.await(15, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue