mirror of https://github.com/apache/activemq.git
https://issues.apache.org/activemq/browse/AMQ-2453 - improve stop procedure
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@959227 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
452ceae26e
commit
a891182114
|
@ -161,7 +161,7 @@ ACTIVEMQ_SSL_OPTS=""
|
|||
|
||||
# ActiveMQ tries to shutdown the broker by jmx,
|
||||
# after a specified number of seconds send SIGKILL
|
||||
ACTIVEMQ_KILL_MAXSECONDS="300"
|
||||
ACTIVEMQ_KILL_MAXSECONDS=30
|
||||
|
||||
## END:DEFAULTCONFIG
|
||||
|
||||
|
@ -332,7 +332,7 @@ invokeJar(){
|
|||
echo "INFO: changing to user '$ACTIVEMQ_USER' to invoke java"
|
||||
fi
|
||||
# Execute java binary
|
||||
if [ -n "$PIDFILE" ];then
|
||||
if [ -n "$PIDFILE" ] && [ "$PIDFILE" != "stop" ];then
|
||||
$DOIT_PREFIX "cd $ACTIVEMQ_CONFIG_DIR; $JAVACMD $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
|
||||
-Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \
|
||||
-Dactivemq.home=\"${ACTIVEMQ_HOME}\" \
|
||||
|
@ -343,6 +343,14 @@ invokeJar(){
|
|||
echo \$APID > $PIDFILE;
|
||||
echo \"INFO: pidfile created : '$PIDFILE' (pid '\$APID')\";exit \$RET" $DOIT_POSTFIX
|
||||
RET="$?"
|
||||
elif [ -n "$PIDFILE" ] && [ "$PIDFILE" == "stop" ];then
|
||||
$DOIT_PREFIX "cd $ACTIVEMQ_CONFIG_DIR; $JAVACMD $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
|
||||
-Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \
|
||||
-Dactivemq.home=\"${ACTIVEMQ_HOME}\" \
|
||||
-Dactivemq.base=\"${ACTIVEMQ_BASE}\" \
|
||||
$ACTIVEMQ_CYGWIN \
|
||||
-jar \"${ACTIVEMQ_HOME}/bin/run.jar\" $COMMANDLINE_ARGS &"
|
||||
RET="$?"
|
||||
else
|
||||
$DOIT_PREFIX "cd $ACTIVEMQ_CONFIG_DIR; $JAVACMD $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
|
||||
-Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \
|
||||
|
@ -467,12 +475,11 @@ invoke_stop(){
|
|||
if ( checkRunning );then
|
||||
ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS $ACTIVEMQ_SSL_OPTS"
|
||||
COMMANDLINE_ARGS="$COMMANDLINE_ARGS $ACTIVEMQ_SUNJMX_CONTROL"
|
||||
invokeJar
|
||||
invokeJar "stop"
|
||||
RET="$?"
|
||||
echo -n "INFO: Waiting at least $ACTIVEMQ_KILL_MAXSECONDS seconds for regular process termination of pid '$(cat $ACTIVEMQ_PIDFILE)' : "
|
||||
FOUND="0"
|
||||
# for i in `seq 0 $ACTIVEMQ_KILL_MAXSECONDS` ;do
|
||||
for i in {1..$ACTIVEMQ_KILL_MAXSECONDS} ;do
|
||||
for ((i=1; i <= ACTIVEMQ_KILL_MAXSECONDS ; i++));do
|
||||
if (checkRunning);then
|
||||
sleep 1
|
||||
echo -n "."
|
||||
|
@ -483,6 +490,7 @@ invoke_stop(){
|
|||
fi
|
||||
done
|
||||
if [ "$FOUND" -ne "1" ];then
|
||||
echo
|
||||
echo "INFO: Regular shutdown not successful, sending SIGKILL to process with pid '$(cat $ACTIVEMQ_PIDFILE)'"
|
||||
kill -KILL $(cat $ACTIVEMQ_PIDFILE)
|
||||
RET="1"
|
||||
|
|
Loading…
Reference in New Issue