ARTEMIS-4375 Block console if starting server from shell

This commit is contained in:
Clebert Suconic 2023-07-31 11:27:25 -04:00
parent 93ee61e35c
commit 2656643267
2 changed files with 11 additions and 5 deletions

View File

@ -216,11 +216,7 @@ public class Artemis implements Runnable {
context.out.println("Home::" + action.getBrokerHome() + ", Instance::" + action.getBrokerInstance());
}
try {
return action.execute(context);
} finally {
action.done();
}
return action.execute(context);
} else {
if (userObject instanceof Runnable) {
((Runnable) userObject).run();

View File

@ -24,6 +24,7 @@ import java.util.concurrent.atomic.AtomicReference;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.api.core.Pair;
import org.apache.activemq.artemis.cli.Artemis;
import org.apache.activemq.artemis.cli.Shell;
import org.apache.activemq.artemis.cli.commands.tools.LockAbstract;
import org.apache.activemq.artemis.cli.factory.BrokerFactory;
import org.apache.activemq.artemis.cli.factory.jmx.ManagementFactory;
@ -155,6 +156,15 @@ public class Run extends LockAbstract {
return serverActivationFailed.get();
}
if (Shell.inShell()) {
while (server.getServer().isStarted()) {
try {
Thread.sleep(1000);
} catch (InterruptedException ignored) {
}
}
}
return new Pair<>(managementContext, server.getServer());
}