mirror of https://github.com/apache/activemq.git
https://issues.apache.org/activemq/browse/AMQ-2975 - shell scripts and multiple broker instances
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1022475 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f142ff7f86
commit
87eba29520
|
@ -267,6 +267,30 @@ public abstract class AbstractJmxCommand extends AbstractCommand {
|
|||
context.printException(e);
|
||||
tokens.clear();
|
||||
}
|
||||
} else if(token.equals("--pid")) {
|
||||
if (isSunJVM()) {
|
||||
if (tokens.isEmpty() || ((String) tokens.get(0)).startsWith("-")) {
|
||||
context.printException(new IllegalArgumentException("pid not specified"));
|
||||
return;
|
||||
}
|
||||
int pid = Integer.parseInt(tokens.remove(0));
|
||||
context.print("Connecting to pid: " + pid);
|
||||
|
||||
String jmxUrl = ConnectorAddressLink.importFrom(pid);
|
||||
// If jmx url already specified
|
||||
if (getJmxServiceUrl() != null) {
|
||||
context.printException(new IllegalArgumentException("JMX URL already specified."));
|
||||
tokens.clear();
|
||||
}
|
||||
try {
|
||||
this.setJmxServiceUrl(new JMXServiceURL(jmxUrl));
|
||||
} catch (MalformedURLException e) {
|
||||
context.printException(e);
|
||||
tokens.clear();
|
||||
}
|
||||
} else {
|
||||
context.printInfo("--pid option is not available for this VM, using default JMX url");
|
||||
}
|
||||
} else if (token.equals("--jmxuser")) {
|
||||
// If no jmx user specified, or next token is a new option
|
||||
if (tokens.isEmpty() || ((String)tokens.get(0)).startsWith("-")) {
|
||||
|
|
|
@ -47,6 +47,7 @@ public class BrowseCommand extends AbstractJmxCommand {
|
|||
" message header, or the message body.",
|
||||
" --view <attr1>,<attr2>,... Select the specific attribute of the message to view.",
|
||||
" --jmxurl <url> Set the JMX URL to connect to.",
|
||||
" --pid <pid> Set the pid to connect to (only on Sun JVM).",
|
||||
" --jmxuser <user> Set the JMX user used for authenticating.",
|
||||
" --jmxpassword <password> Set the JMX password used for authenticating.",
|
||||
" --jmxlocal Use the local JMX server instead of a remote one.",
|
||||
|
|
|
@ -29,6 +29,7 @@ public class BstatCommand extends QueryCommand {
|
|||
"",
|
||||
"Bstat Options:",
|
||||
" --jmxurl <url> Set the JMX URL to connect to.",
|
||||
" --pid <pid> Set the pid to connect to (only on Sun JVM).",
|
||||
" --jmxuser <user> Set the JMX user used for authenticating.",
|
||||
" --jmxpassword <password> Set the JMX password used for authenticating.",
|
||||
" --jmxlocal Use the local JMX server instead of a remote one.",
|
||||
|
|
|
@ -30,6 +30,7 @@ public class ListCommand extends AbstractJmxCommand {
|
|||
"",
|
||||
"List Options:",
|
||||
" --jmxurl <url> Set the JMX URL to connect to.",
|
||||
" --pid <pid> Set the pid to connect to (only on Sun JVM).",
|
||||
" --jmxuser <user> Set the JMX user used for authenticating.",
|
||||
" --jmxpassword <password> Set the JMX password used for authenticating.",
|
||||
" --jmxlocal Use the local JMX server instead of a remote one.",
|
||||
|
|
|
@ -39,6 +39,7 @@ public class PurgeCommand extends AbstractJmxCommand {
|
|||
" --msgsel <msgsel1,msglsel2> Add to the search list messages matched by the query similar to",
|
||||
" the messages selector format.",
|
||||
" --jmxurl <url> Set the JMX URL to connect to.",
|
||||
" --pid <pid> Set the pid to connect to (only on Sun JVM).",
|
||||
" --jmxuser <user> Set the JMX user used for authenticating.",
|
||||
" --jmxpassword <password> Set the JMX password used for authenticating.",
|
||||
" --jmxlocal Use the local JMX server instead of a remote one.",
|
||||
|
|
|
@ -55,6 +55,7 @@ public class QueryCommand extends AbstractJmxCommand {
|
|||
" --view <attr1>,<attr2>,... Select the specific attribute of the object to view.",
|
||||
" By default all attributes will be displayed.",
|
||||
" --jmxurl <url> Set the JMX URL to connect to.",
|
||||
" --pid <pid> Set the pid to connect to (only on Sun JVM).",
|
||||
" --jmxuser <user> Set the JMX user used for authenticating.",
|
||||
" --jmxpassword <password> Set the JMX password used for authenticating.",
|
||||
" --jmxlocal Use the local JMX server instead of a remote one.",
|
||||
|
|
|
@ -35,6 +35,7 @@ public class ShutdownCommand extends AbstractJmxCommand {
|
|||
"",
|
||||
"Stop Options:",
|
||||
" --jmxurl <url> Set the JMX URL to connect to.",
|
||||
" --pid <pid> Set the pid to connect to (only on Sun JVM).",
|
||||
" --jmxuser <user> Set the JMX user used for authenticating.",
|
||||
" --jmxpassword <password> Set the JMX password used for authenticating.",
|
||||
" --jmxlocal Use the local JMX server instead of a remote one.",
|
||||
|
|
|
@ -85,12 +85,16 @@ if [ -z "$ACTIVEMQ_HOME" ] ; then
|
|||
ACTIVEMQ_HOME=`cd "$ACTIVEMQ_HOME" && pwd`
|
||||
fi
|
||||
|
||||
if [ -z "$ACTIVEMQ_BASE" ] ; then
|
||||
ACTIVEMQ_BASE="$ACTIVEMQ_HOME"
|
||||
fi
|
||||
|
||||
# Active MQ configuration directory
|
||||
ACTIVEMQ_CONFIG_DIR="$ACTIVEMQ_HOME/conf"
|
||||
ACTIVEMQ_CONFIG_DIR="$ACTIVEMQ_BASE/conf"
|
||||
|
||||
# Active MQ configuration directory
|
||||
if [ -z "$ACTIVEMQ_DATA_DIR" ]; then
|
||||
ACTIVEMQ_DATA_DIR="$ACTIVEMQ_HOME/data"
|
||||
ACTIVEMQ_DATA_DIR="$ACTIVEMQ_BASE/data"
|
||||
fi
|
||||
|
||||
if [ ! -d "$ACTIVEMQ_DATA_DIR" ]; then
|
||||
|
@ -363,7 +367,7 @@ invokeJar(){
|
|||
-Dactivemq.home=\"${ACTIVEMQ_HOME}\" \
|
||||
-Dactivemq.base=\"${ACTIVEMQ_BASE}\" \
|
||||
$ACTIVEMQ_CYGWIN \
|
||||
-jar \"${ACTIVEMQ_HOME}/bin/run.jar\" $COMMANDLINE_ARGS &
|
||||
-jar \"${ACTIVEMQ_HOME}/bin/run.jar\" $COMMANDLINE_ARGS --pid $(cat $ACTIVEMQ_PIDFILE) &
|
||||
RET=\"\$?\"; APID=\"\$!\";
|
||||
echo \$APID > $ACTIVEMQ_DATA_DIR/stop.pid" $DOIT_POSTFIX
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue