Commit 1d21822d authored by Yann Mombrun's avatar Yann Mombrun

Fix #7 by purging all queues when resetting

Rework the whole reset part to also stop all servers (to prevent from
processing files at the same time)
parent eeded591
Pipeline #2891 passed with stages
in 16 minutes and 7 seconds
......@@ -151,7 +151,7 @@ public class ActiveMQServer extends AbstractApplicationServer {
/**
* @param queue
* The name of the queue to purge
* The name of the queue to purge. If null, then purge all queues
*/
public void purge(final String queue) {
boolean queueFound = false;
......@@ -163,13 +163,13 @@ public class ActiveMQServer extends AbstractApplicationServer {
}
for (final ObjectName queueName : this.listQueues(connection)) {
final QueueViewMBean queueMbean = MBeanServerInvocationHandler.newProxyInstance(connection, queueName, QueueViewMBean.class, true);
if (queue.equals(queueMbean.getName())) {
if (queue == null || queue.equals(queueMbean.getName())) {
queueFound = true;
if (queueMbean.getQueueSize() > 0) {
this.logger.info("Purging queue " + queue + ".");
this.logger.info("Purging queue " + queueMbean.getName() + ".");
queueMbean.purge();
} else {
this.logger.info("Queue " + queue + " is empty. Nothing to purge.");
this.logger.info("Queue " + queueMbean.getName() + " is empty. Nothing to purge.");
}
}
}
......@@ -181,7 +181,6 @@ public class ActiveMQServer extends AbstractApplicationServer {
if (!queueFound) {
this.logger.warn("Queue " + queue + " does not exist. Nothing to purge.");
}
}
}
......@@ -413,7 +413,7 @@ public class ServerManager {
if (liferay.becomeReadyOrDieTrying()) {
this.logger.info("Liferay is started");
} else {
this.logger.error("LIferay could not completely start (server and all needed webapps). Please check previous error if any or see " + liferay.getSubDir("logs")
this.logger.error("Liferay could not completely start (server and all needed webapps). Please check previous error if any or see " + liferay.getSubDir("logs")
+ "catalina.out for more details.");
}
}
......@@ -471,10 +471,7 @@ public class ServerManager {
this.logger.warn("Action : \"" + command + "\" not supported on bus.");
}
} else
{
} else {
this.logger.warn(server + " does not support remote execution.");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment