From 85723f9a0c9bdffad07b56dbbc5ec39dc8a70ba7 Mon Sep 17 00:00:00 2001 From: Aidan Skinner Date: Wed, 23 Apr 2008 23:53:55 +0000 Subject: QPID-832 copy the M2.x broker git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@651112 13f79535-47bb-0310-9956-ffa450edef68 --- java/broker/bin/msTool.sh | 60 ++++++++++++++++ java/broker/bin/qpid-passwd | 30 ++++++++ java/broker/bin/qpid-server | 31 ++++++++ java/broker/bin/qpid-server-bdb.bat | 22 ++++++ java/broker/bin/qpid-server.bat | 70 ++++++++++++++++++ java/broker/bin/qpid.start | 21 ++++++ java/broker/bin/qpid.stop | 137 ++++++++++++++++++++++++++++++++++++ java/broker/bin/qpid.stopall | 74 +++++++++++++++++++ java/broker/bin/run.bat | 31 ++++++++ java/broker/bin/run.sh | 44 ++++++++++++ java/broker/bin/runAll | 37 ++++++++++ 11 files changed, 557 insertions(+) create mode 100755 java/broker/bin/msTool.sh create mode 100644 java/broker/bin/qpid-passwd create mode 100644 java/broker/bin/qpid-server create mode 100644 java/broker/bin/qpid-server-bdb.bat create mode 100644 java/broker/bin/qpid-server.bat create mode 100644 java/broker/bin/qpid.start create mode 100644 java/broker/bin/qpid.stop create mode 100644 java/broker/bin/qpid.stopall create mode 100755 java/broker/bin/run.bat create mode 100755 java/broker/bin/run.sh create mode 100644 java/broker/bin/runAll (limited to 'java/broker/bin') diff --git a/java/broker/bin/msTool.sh b/java/broker/bin/msTool.sh new file mode 100755 index 0000000000..73b1eb2ec7 --- /dev/null +++ b/java/broker/bin/msTool.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +die() { + if [[ $1 = -usage ]]; then + shift + usage=true + else + usage=false + fi + echo "$@" + $usage && echo + $usage && usage + exit 1 +} + +cygwin=false +if [[ "$(uname -a | fgrep Cygwin)" != "" ]]; then + cygwin=true +fi + +if [ -z "$QPID_TOOLS" ]; then + if [ -z "$QPID_HOME" ]; then + die "QPID_TOOLS must be set" + else + QPID_TOOLS=$QPID_HOME + fi +fi + +if $cygwin; then + QPID_TOOLS=$(cygpath -w $QPID_TOOLS) +fi + +# Set classpath to include Qpid jar with all required jars in manifest +QPID_LIBS=$QPID_TOOLS/lib/qpid-incubating.jar + +# Set other variables used by the qpid-run script before calling +export JAVA=java \ + JAVA_VM=-server \ + JAVA_OPTS=-Dlog4j.configuration=file:$QPID_TOOLS/etc/mstool-log4j.xml \ + QPID_CLASSPATH=$QPID_LIBS + +. qpid-run org.apache.qpid.tools.messagestore.MessageStoreTool "$@" diff --git a/java/broker/bin/qpid-passwd b/java/broker/bin/qpid-passwd new file mode 100644 index 0000000000..f046252522 --- /dev/null +++ b/java/broker/bin/qpid-passwd @@ -0,0 +1,30 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# Set classpath to include Qpid jar with all required jars in manifest +QPID_LIBS=$QPID_HOME/lib/qpid-incubating.jar + +# Set other variables used by the qpid-run script before calling +export JAVA=java \ + JAVA_VM=-server \ + JAVA_MEM=-Xmx1024m \ + QPID_CLASSPATH=$QPID_LIBS + +. qpid-run org.apache.qpid.tools.security.Passwd "$@" diff --git a/java/broker/bin/qpid-server b/java/broker/bin/qpid-server new file mode 100644 index 0000000000..d0198f8dc9 --- /dev/null +++ b/java/broker/bin/qpid-server @@ -0,0 +1,31 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# Set classpath to include Qpid jar with all required jars in manifest +QPID_LIBS=$QPID_HOME/lib/qpid-incubating.jar:$QPID_HOME/lib/bdbstore-launch.jar + +# Set other variables used by the qpid-run script before calling +export JAVA=java \ + JAVA_VM=-server \ + JAVA_MEM=-Xmx1024m \ + JAVA_GC="-XX:+UseConcMarkSweepGC -XX:+HeapDumpOnOutOfMemoryError" \ + QPID_CLASSPATH=$QPID_LIBS + +. qpid-run org.apache.qpid.server.Main "$@" diff --git a/java/broker/bin/qpid-server-bdb.bat b/java/broker/bin/qpid-server-bdb.bat new file mode 100644 index 0000000000..8964e577df --- /dev/null +++ b/java/broker/bin/qpid-server-bdb.bat @@ -0,0 +1,22 @@ +@REM +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM + +set BDBSTORE_HOME=c:\qpid\trunk\java\bdbstore +set QPID_MODULE_JARS=%BDBSTORE_HOME%\target\qpid-bdbstore-1.0-incubating-M2-SNAPSHOT.jar;%BDBSTORE_HOME%\lib\bdb\je-3.1.0.jar +.\qpid-server.bat \ No newline at end of file diff --git a/java/broker/bin/qpid-server.bat b/java/broker/bin/qpid-server.bat new file mode 100644 index 0000000000..a99022cd2d --- /dev/null +++ b/java/broker/bin/qpid-server.bat @@ -0,0 +1,70 @@ +@REM +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM + +echo off +REM Script to run the Qpid Java Broker + +rem Guess QPID_HOME if not defined +set CURRENT_DIR=%cd% +if not "%QPID_HOME%" == "" goto gotHome +set QPID_HOME=%CURRENT_DIR% +echo %QPID_HOME% +if exist "%QPID_HOME%\bin\qpid-server.bat" goto okHome +cd .. +set QPID_HOME=%cd% +cd %CURRENT_DIR% +:gotHome +if exist "%QPID_HOME%\bin\qpid-server.bat" goto okHome +echo The QPID_HOME environment variable is not defined correctly +echo This environment variable is needed to run this program +goto end +:okHome + +if not "%JAVA_HOME%" == "" goto gotJavaHome +echo The JAVA_HOME environment variable is not defined +echo This environment variable is needed to run this program +goto exit +:gotJavaHome +if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome +goto okJavaHome +:noJavaHome +echo The JAVA_HOME environment variable is not defined correctly +echo This environment variable is needed to run this program. +goto exit +:okJavaHome + +rem Slurp the command line arguments. This loop allows for an unlimited number +rem of agruments (up to the command line limit, anyway). +set QPID_ARGS=%1 +if ""%1""=="""" goto runCommand +shift +:loop +if ""%1""=="""" goto runCommand +set QPID_ARGS=%QPID_ARGS% %1 +shift +goto loop + +rem QPID_OPTS intended to hold any -D props for use +rem user must enclose any value for QPID_OPTS in double quotes +:runCommand +set LAUNCH_JAR=%QPID_HOME%\lib\qpid-incubating.jar +set MODULE_JARS=%QPID_MODULE_JARS% +"%JAVA_HOME%\bin\java" -server -Xmx1024m %QPID_OPTS% -DQPID_HOME="%QPID_HOME%" -cp "%LAUNCH_JAR%;%MODULE_JARS%" org.apache.qpid.server.Main %QPID_ARGS% + +:end diff --git a/java/broker/bin/qpid.start b/java/broker/bin/qpid.start new file mode 100644 index 0000000000..78c34e70b4 --- /dev/null +++ b/java/broker/bin/qpid.start @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +exec qpid-server -run:debug "$@" \ No newline at end of file diff --git a/java/broker/bin/qpid.stop b/java/broker/bin/qpid.stop new file mode 100644 index 0000000000..6482fc3293 --- /dev/null +++ b/java/broker/bin/qpid.stop @@ -0,0 +1,137 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# qpid.stop Script +# +# Script checks for a given pid running PROGRAM and attempts to quit it +# + +MAX_ATTEMPTS=1 +SLEEP_DELAY=1 +PROGRAM="DQPID" + + +# +# Print what is going to be done +# +printActions() +{ +#ps=`ps o command p $1|grep $PROGRAM` +ps=`ps -o args -p $1|grep $PROGRAM` +echo "Attempting to kill: $ps" +} + +# +# Forcably Quit the specified PID($1) +# +forceQuit() +{ +kill -9 $1 +} + + +# +# Gracefully ask the PID($1) to quit +# +quit() +{ +kill $1 +} + +# +# Grep the ps log for the PID ($1) to ensure that it has quit +# +lookup() +{ +result=`ps -o args -p $1 |grep -v grep |grep $PROGRAM |wc -l` +} + +# +# Sleep and then check then lookup the PID($1) to ensure it has quit +# +check() +{ +echo "Waiting $SLEEP_DELAY second for $1 to exit" +sleep $SLEEP_DELAY +lookup $1 +} + + + +# +# Verify the PID($1) is available +# +verifyPid() +{ +lookup $1 +if [[ $[$result] == 1 ]] ; then + brokerspid=$1 +else + echo "Unable to locate Qpid Process with PID $1" + exit -1 +fi +} + +# +# Main Run +# + +# Check if we are killing all qpid pids or just one. +if [[ $# == 0 ]] ; then + echo "Killing All Qpid Brokers for user: '$USER'" + qpid.stopall + exit $? +else + verifyPid $1 +fi + +printActions $brokerspid + +# Attempt to quit the process MAX_ATTEMPTS Times +attempt=0 +while [[ $[$result] > 0 && $[$attempt] < $[$MAX_ATTEMPTS] ]] ; do + quit $brokerspid + check $brokerspid + attempt=$[$attempt + 1] +done + +# Check that it has quit +if [[ $[$result] == 0 ]] ; then + echo "Process quit" + exit 0 +else + + # Now attempt to force quit the process + attempt=0 + while [[ $[$result] > 0 && $[$attempt] < $[$MAX_ATTEMPTS] ]] ; do + forceQuit $brokerspid + check $brokerspid + attempt=$[$attempt + 1] + done + + + # Output final status + if [[ $[$result] > 0 && $[$attempt] == $[$MAX_ATTEMPTS] ]] ; then + echo "Stopped trying to kill process: $brokerspid" + echo "Attempted to stop $attempt times" + else + echo "Done " + fi +fi diff --git a/java/broker/bin/qpid.stopall b/java/broker/bin/qpid.stopall new file mode 100644 index 0000000000..d71f591de8 --- /dev/null +++ b/java/broker/bin/qpid.stopall @@ -0,0 +1,74 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# qpid.stopall script +# +# Script attempts to stop all PROGRAMs running under the current user +# Utilises qpid.stop to perform the actual stopping +# + +PROGRAM="DQPID" + +# +# grep ps for instances of $PROGRAM and collect PIDs +# +lookup() +{ +#pids=`ps o pid,command | grep $PROGRAM | grep -v grep | cut -d ' ' -f 1` +pids=`ps -ef |grep $USER | grep $PROGRAM | grep -v grep | awk '{print $2}'` +result=`echo -n $pids | wc -w` +} + + +# +# Show the PS output for given set of pids +# +showPids() +{ +ps -o user,pid,args -p $pids +} + + +# +# Main Run +# + +lookup + +if [[ $[$result] == 0 ]] ; then + echo "No Qpid Brokers found running under user '$USER'" + exit 0 +fi + +for pid in $pids ; do + +qpid.stop $pid + +done + +# Check we have quit all +lookup + +if [[ $[$result] == 0 ]] ; then + echo "All Qpid brokers successfully quit" +else + echo "Some brokers were not quit" + showPids $pids +fi diff --git a/java/broker/bin/run.bat b/java/broker/bin/run.bat new file mode 100755 index 0000000000..5b0aa0f23b --- /dev/null +++ b/java/broker/bin/run.bat @@ -0,0 +1,31 @@ +@REM +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM + +@echo off +set CORE_CLASSES=..\classes;..\testclasses + +set COMMONDIR=..\..\common + +set COMMONLIB=%COMMONDIR%\lib\slf4j\slf4j-simple.jar;%COMMONDIR%\lib\logging-log4j\log4j-1.2.9.jar;%COMMONDIR%\lib\mina\mina-core-0.9.2.jar + +set DIST=..\lib\bdb\je-3.0.12.jar;..\dist\amqpd.jar;..\..\client\dist\amqp-common.jar + +set CP=%CORE_CLASSES%;%DIST%;%COMMONLIB% + +"%JAVA_HOME%\bin\java" -Xmx512m -Damqj.logging.level=INFO -cp %CP% %* diff --git a/java/broker/bin/run.sh b/java/broker/bin/run.sh new file mode 100755 index 0000000000..6b62049e94 --- /dev/null +++ b/java/broker/bin/run.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + + +COMMONDIR=../../common + +COMMONLIB=$COMMONLIB:$COMMONDIR/lib/slf4j/slf4j-simple.jar +COMMONLIB=$COMMONLIB:$COMMONDIR/lib/logging-log4j/log4j-1.2.13.jar +COMMONLIB=$COMMONLIB:$COMMONDIR/lib/mina/mina-core-0.9.5-SNAPSHOT.jar +COMMONLIB=$COMMONLIB:$COMMONDIR/lib/mina/mina-filter-ssl-0.9.5-SNAPSHOT.jar +COMMONLIB=$COMMONLIB:$COMMONDIR/lib/commons-collections/commons-collections-3.1.jar +COMMONLIB=$COMMONLIB:$COMMONDIR/lib/commons-cli/commons-cli-1.0.jar +COMMONLIB=$COMMONLIB:$COMMONDIR/lib/commons-configuration/commons-configuration-1.2.jar +COMMONLIB=$COMMONLIB:$COMMONDIR/lib/commons-logging/commons-logging-api.jar +COMMONLIB=$COMMONLIB:$COMMONDIR/lib/commons-logging/commons-logging.jar +COMMONLIB=$COMMONLIB:$COMMONDIR/lib/commons-lang/commons-lang-2.1.jar +COMMONLIB=$COMMONLIB:$COMMONDIR/lib/junit/junit-4.0.jar + +DIST=../lib/bdb/je-3.0.12.jar:../dist/amqpd-tests.jar:../dist/amqpd.jar:../../client/dist/amqp-common.jar + +CP=../intellijclasses:$DIST:$COMMONLIB + +if [ "$(uname -a | fgrep Cygwin)" != "" ]; then + CP=$(cygpath --mixed --path $CP) +fi + +"$JAVA_HOME/bin/java" -Xmx512m -Dprepopulate=10 -Damqj.logging.level=INFO -cp $CP $* diff --git a/java/broker/bin/runAll b/java/broker/bin/runAll new file mode 100644 index 0000000000..4ced1d263b --- /dev/null +++ b/java/broker/bin/runAll @@ -0,0 +1,37 @@ +#!/bin/sh + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +doRun() +{ + class=$1 + shift + echo + echo ================================================================================ + echo Running $class + ./run.sh $class "$@" +} + +# parameters are: clients messages iterations +doRun org.apache.qpid.server.queue.SendPerfTest 10 1000 100 + +doRun org.apache.qpid.server.queue.QueuePerfTest + +doRun org.apache.qpid.server.queue.QueueConcurrentPerfTest -- cgit v1.2.1