mirror of https://github.com/apache/activemq.git
AMQ4221Test - remove system exit as it breaks surefire fork, https://issues.apache.org/jira/browse/AMQ-6004 interrupt causes errors on shutdown. Two are sorted but the check for errors in the logs may still cause intermittent failures
This commit is contained in:
parent
d7a3b9406b
commit
15412bae64
|
@ -47,6 +47,7 @@ import javax.jms.JMSException;
|
|||
import javax.jms.ResourceAllocationException;
|
||||
|
||||
import org.apache.activemq.broker.BrokerService;
|
||||
import org.apache.activemq.broker.BrokerStoppedException;
|
||||
import org.apache.activemq.broker.ConnectionContext;
|
||||
import org.apache.activemq.broker.ProducerBrokerExchange;
|
||||
import org.apache.activemq.broker.region.cursors.OrderedPendingList;
|
||||
|
@ -1132,6 +1133,7 @@ public class Queue extends BaseDestination implements Task, UsageListener, Index
|
|||
|
||||
// we need a store iterator to walk messages on disk, independent of the cursor which is tracking
|
||||
// the next message batch
|
||||
} catch (BrokerStoppedException ignored) {
|
||||
} catch (Exception e) {
|
||||
LOG.error("Problem retrieving message for browse", e);
|
||||
}
|
||||
|
|
|
@ -441,8 +441,8 @@ public class TcpTransportServer extends TransportServerThreadSupport implements
|
|||
}
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
LOG.info("socketQueue interuppted - stopping");
|
||||
if (!isStopping()) {
|
||||
if (!isStopped() || !isStopping()) {
|
||||
LOG.info("socketQueue interrupted - stopping");
|
||||
onAcceptError(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.activemq.bugs;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
@ -74,6 +75,7 @@ public class AMQ4221Test extends TestSupport {
|
|||
private String brokerUrlString;
|
||||
ExecutorService executorService = Executors.newCachedThreadPool();
|
||||
final AtomicBoolean done = new AtomicBoolean(false);
|
||||
final LinkedList<String> errorsInLog = new LinkedList<String>();
|
||||
|
||||
public static Test suite() {
|
||||
return suite(AMQ4221Test.class);
|
||||
|
@ -87,18 +89,15 @@ public class AMQ4221Test extends TestSupport {
|
|||
@Override
|
||||
public void doAppend(LoggingEvent event) {
|
||||
if (event.getLevel().isGreaterOrEqual(Level.ERROR)) {
|
||||
System.err.println("exit on error: " + event.getMessage());
|
||||
System.err.println("Fail on error in log: " + event.getMessage());
|
||||
done.set(true);
|
||||
new Thread() {
|
||||
public void run() {
|
||||
System.exit(787);
|
||||
}
|
||||
}.start();
|
||||
errorsInLog.add(event.getRenderedMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
done.set(false);
|
||||
errorsInLog.clear();
|
||||
brokerService = new BrokerService();
|
||||
brokerService.setDeleteAllMessagesOnStartup(true);
|
||||
brokerService.setDestinations(new ActiveMQDestination[]{new ActiveMQQueue("ActiveMQ.DLQ")});
|
||||
|
@ -186,6 +185,7 @@ public class AMQ4221Test extends TestSupport {
|
|||
executorService.awaitTermination(5, TimeUnit.MINUTES);
|
||||
|
||||
assertTrue("no exceptions:" + exceptions, exceptions.isEmpty());
|
||||
assertTrue("No ERROR in log:" + errorsInLog, errorsInLog.isEmpty());
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue