directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lucasthei...@apache.org
Subject svn commit: r1690296 - in /directory/apacheds/trunk: installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/apacheds.sh service/src/main/java/org/apache/directory/server/UberjarMain.java
Date Fri, 10 Jul 2015 17:47:00 GMT
Author: lucastheisen
Date: Fri Jul 10 17:47:00 2015
New Revision: 1690296

URL: http://svn.apache.org/r1690296
Log:
DIRSERVER-2080: Add a way to politely stop apacheds from apacheds.sh, part 2

Modified:
    directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/apacheds.sh
    directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/UberjarMain.java

Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/apacheds.sh
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/apacheds.sh?rev=1690296&r1=1690295&r2=1690296&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/apacheds.sh
(original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/apacheds.sh
Fri Jul 10 17:47:00 2015
@@ -39,8 +39,9 @@
 #                   Extended operations to register.
 #   ADS_SHUTDOWN_PORT
 #                   (Optional) If specified, it must be a valid port number
-#                   on which ApacheDS will listen for a connection to trigger
-#                   a polite shutdown.  Defaults to 10390.
+#                   between 1024 and 65536 on which ApacheDS will listen for 
+#                   a connection to trigger a polite shutdown.  Defaults to 0
+#                   indicating a dynamic port allocation.
 #
 #   JAVA_HOME       (Optional) The java installation directory.  If not
 #                   not specified, the java from $PATH will be used.
@@ -48,7 +49,7 @@
 #   JAVA_OPTS       (Optional) Any additional java options (ex: -Xms:256m)
 
 # Defaults
-ADS_SHUTDOWN_PORT=10390
+ADS_SHUTDOWN_PORT=0
 
 # Detect ads home (http://stackoverflow.com/a/630387/516433)
 PROGRAM_DIR="`dirname \"$0\"`"
@@ -185,7 +186,7 @@ elif [ "$ADS_ACTION" = "stop" ]; then
         [ $HAVE_TTY -eq 1 ] && echo "Stopping ApacheDS instance '$ADS_INSTANCE_NAME'
running as $PID"
 
         # Terminate the process
-        if [ $ADS_SHUTDOWN_PORT -gt 0 ]; then
+        if [ $ADS_SHUTDOWN_PORT -ge 0 ]; then
             eval "\"$RUN_JAVA\"" $JAVA_OPTS $ADS_CONTROLS $ADS_EXTENDED_OPERATIONS \
                 -Dlog4j.configuration="\"file:$ADS_INSTANCE/conf/log4j.properties\"" \
                 -Dapacheds.log.dir="\"$ADS_INSTANCE/log\"" \

Modified: directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/UberjarMain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/UberjarMain.java?rev=1690296&r1=1690295&r2=1690296&view=diff
==============================================================================
--- directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/UberjarMain.java
(original)
+++ directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/UberjarMain.java
Fri Jul 10 17:47:00 2015
@@ -88,8 +88,10 @@ public class UberjarMain
                             {
                                 writeShutdownPort( instanceDirectory, shutdownSocket.getLocalPort()
);
 
+                                LOG.info( "Start the shutdown listener on port [{}]", 
+                                        shutdownSocket.getLocalPort() );
+
                                 Socket socket;
-                                LOG.info( "Start the shutdown listener on port [{}]", shutdownPort
);
                                 while ( (socket = shutdownSocket.accept()) != null )
                                 {
                                     if ( shutdownPassword == null || shutdownPassword.isEmpty()
) {
@@ -147,7 +149,7 @@ public class UberjarMain
     private static int getShutdownPort()
     {
         int shutdownPort = Integer.parseInt( System.getProperty( PROPERTY_SHUTDOWN_PORT,
"0" ) );
-        if ( shutdownPort < 1024 || shutdownPort > 65536 )
+        if ( shutdownPort < 0 || (shutdownPort > 0 && shutdownPort < 1024)
|| shutdownPort > 65536 )
         {
             throw new IllegalArgumentException( "Shutdown port [" + shutdownPort + "] is
an illegal port number" );
         }



Mime
View raw message