Merge branch 'stable-3.5' into stable-3.6

* stable-3.5:
  Make extra stop timeout configurable

Release-Notes: skip
Change-Id: I3aa276bc84bd11e858b13ea19ef8e2878145ab07
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt
index 524b171..45d4fc6 100644
--- a/Documentation/config-gerrit.txt
+++ b/Documentation/config-gerrit.txt
@@ -1909,6 +1909,13 @@
 to run a new Gerrit daemon successfully.  If not set, defaults to
 90 seconds.
 
+[[container.shutdownTimeout]]container.shutdownTimeout::
++
+The maximum time (in seconds) to wait for a gerrit.sh stop command.
+This is added to the highest value between either 'sshd.gracefulStopTimeout'
+or 'httpd.gracefulStopTimeout'. If not set, defaults to
+30 seconds
+
 [[container.user]]container.user::
 +
 Login name (or UID) of the operating system user the Gerrit JVM
diff --git a/resources/com/google/gerrit/pgm/init/gerrit.sh b/resources/com/google/gerrit/pgm/init/gerrit.sh
index e7fda5a..257dc61 100755
--- a/resources/com/google/gerrit/pgm/init/gerrit.sh
+++ b/resources/com/google/gerrit/pgm/init/gerrit.sh
@@ -353,7 +353,7 @@
 #####################################################
 # Configure the maximum wait time for shutdown
 #####################################################
-EXTRA_STOP_TIMEOUT=30
+EXTRA_STOP_TIMEOUT=$(get_time_unit_sec "$(get_config --get container.shutdownTimeout || echo 30)")
 HTTPD_STOP_TIMEOUT=$(get_time_unit_sec "$(get_config --get httpd.gracefulStopTimeout || echo 0)")
 SSHD_STOP_TIMEOUT=$(get_time_unit_sec "$(get_config --get sshd.gracefulStopTimeout || echo 0)")