From 96e9a158d73e3878dcd9b455f0412c6ae5c007cc Mon Sep 17 00:00:00 2001
From: Leila Gonzales <lmg@agiweb.org>
Date: Fri, 18 Nov 2016 10:50:49 -0800
Subject: [PATCH] Solr additional JVM options variable (#854)

---
 solr.bat |  5 ++++-
 solr.sh  | 10 +++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/solr.bat b/solr.bat
index 13b1577c591..f61c08a86f2 100644
--- a/solr.bat
+++ b/solr.bat
@@ -21,6 +21,9 @@ rem
 rem JAVA_HOME
 rem   Home of Java installation (not directly used by this script, but passed along to
 rem   the standard Solr control script).
+rem
+rem SOLR_ADDITIONAL_JVM_OPTIONS
+rem   Additional options to pass to the JVM when launching Solr.
 
 rem Make sure that environment edits are local and that we have access to the
 rem Windows command extensions.
@@ -74,7 +77,7 @@ if not "!%SOLR_PORT%!"=="!!" goto solrportset
 set SOLR_PORT=8080
 :solrportset
 
-call %SOLR_BIN%\solr.cmd %1 -p %SOLR_PORT% -s %SOLR_HOME% -m %SOLR_HEAP% -a "-Dsolr.log=%SOLR_LOGS_DIR%"
+call %SOLR_BIN%\solr.cmd %1 -p %SOLR_PORT% -s %SOLR_HOME% -m %SOLR_HEAP% -a "-Dsolr.log=%SOLR_LOGS_DIR% %SOLR_ADDITIONAL_JVM_OPTIONS%"
 goto end
 
 :usage
diff --git a/solr.sh b/solr.sh
index 2a4956dc0db..d9b33a82158 100755
--- a/solr.sh
+++ b/solr.sh
@@ -23,6 +23,9 @@
 #   Home of Java installation (not directly used by this script, but passed along to
 #   the standard Solr control script).
 #
+# SOLR_ADDITIONAL_JVM_OPTIONS
+#   Additional options to pass to the JVM when launching Solr.
+#
 
 usage()
 {
@@ -64,5 +67,10 @@ then
   SOLR_PORT="8080"
 fi
 
+if [ -z "$SOLR_ADDITIONAL_JVM_OPTIONS" ]
+then
+  SOLR_ADDITIONAL_JVM_OPTIONS=""
+fi
+
 export SOLR_LOGS_DIR=$SOLR_LOGS_DIR
-"$SOLR_BIN/solr" "$1" -p "$SOLR_PORT" -s "$SOLR_HOME" -m "$SOLR_HEAP" -a "-Dsolr.log=$SOLR_LOGS_DIR"
+"$SOLR_BIN/solr" "$1" -p "$SOLR_PORT" -s "$SOLR_HOME" -m "$SOLR_HEAP" -a "-Dsolr.log=$SOLR_LOGS_DIR $SOLR_ADDITIONAL_JVM_OPTIONS"
-- 
GitLab