Author: dejanb
Date: Thu Oct 14 12:04:49 2010
New Revision: 1022475
URL: http://svn.apache.org/viewvc?rev=1022475&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQ-2975 - shell scripts and multiple
broker instances
Modified:
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/AbstractJmxCommand.java
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BrowseCommand.java
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ListCommand.java
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/PurgeCommand.java
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/QueryCommand.java
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ShutdownCommand.java
activemq/trunk/assembly/src/release/bin/activemq
Modified:
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/AbstractJmxCommand.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/AbstractJmxCommand.java?rev=1022475&r1=1022474&r2=1022475&view=diff
==============================================================================
---
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/AbstractJmxCommand.java
(original)
+++
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/AbstractJmxCommand.java
Thu Oct 14 12:04:49 2010
@@ -267,6 +267,30 @@ public abstract class AbstractJmxCommand
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("-")) {
Modified:
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BrowseCommand.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BrowseCommand.java?rev=1022475&r1=1022474&r2=1022475&view=diff
==============================================================================
---
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BrowseCommand.java
(original)
+++
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BrowseCommand.java
Thu Oct 14 12:04:49 2010
@@ -47,6 +47,7 @@ public class BrowseCommand extends Abstr
" 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.",
Modified:
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java?rev=1022475&r1=1022474&r2=1022475&view=diff
==============================================================================
---
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java
(original)
+++
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java
Thu Oct 14 12:04:49 2010
@@ -29,6 +29,7 @@ public class BstatCommand extends QueryC
"",
"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.",
Modified:
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ListCommand.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ListCommand.java?rev=1022475&r1=1022474&r2=1022475&view=diff
==============================================================================
---
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ListCommand.java
(original)
+++
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ListCommand.java
Thu Oct 14 12:04:49 2010
@@ -30,6 +30,7 @@ public class ListCommand extends Abstrac
"",
"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.",
Modified:
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/PurgeCommand.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/PurgeCommand.java?rev=1022475&r1=1022474&r2=1022475&view=diff
==============================================================================
---
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/PurgeCommand.java
(original)
+++
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/PurgeCommand.java
Thu Oct 14 12:04:49 2010
@@ -39,6 +39,7 @@ public class PurgeCommand extends Abstra
" --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.",
Modified:
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/QueryCommand.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/QueryCommand.java?rev=1022475&r1=1022474&r2=1022475&view=diff
==============================================================================
---
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/QueryCommand.java
(original)
+++
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/QueryCommand.java
Thu Oct 14 12:04:49 2010
@@ -55,6 +55,7 @@ public class QueryCommand extends Abstra
" --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.",
Modified:
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ShutdownCommand.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ShutdownCommand.java?rev=1022475&r1=1022474&r2=1022475&view=diff
==============================================================================
---
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ShutdownCommand.java
(original)
+++
activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ShutdownCommand.java
Thu Oct 14 12:04:49 2010
@@ -35,6 +35,7 @@ public class ShutdownCommand extends Abs
"",
"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.",
Modified: activemq/trunk/assembly/src/release/bin/activemq
URL:
http://svn.apache.org/viewvc/activemq/trunk/assembly/src/release/bin/activemq?rev=1022475&r1=1022474&r2=1022475&view=diff
==============================================================================
--- activemq/trunk/assembly/src/release/bin/activemq (original)
+++ activemq/trunk/assembly/src/release/bin/activemq Thu Oct 14 12:04:49 2010
@@ -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