HBASE-15199 (addendum) - When JRUBY_HOME is specified, update CLASSPATH and HBASE_OPTS when jruby is needed
Signed-off-by: Sean Busbey <busbey@apache.org> Signed-off-by: tedyu <yuzhihong@gmail.com> Signed-off-by: Jerry He <jerryjch@apache.org>
This commit is contained in:
parent
c38bf12444
commit
b67f6fecc1
38
bin/hbase
38
bin/hbase
|
@ -294,32 +294,34 @@ if [ "$AUTH_AS_SERVER" == "true" ] || [ "$COMMAND" = "hbck" ]; then
|
|||
fi
|
||||
|
||||
# for jruby
|
||||
# (1) when JRUBY_HOME is specified explicitly, eg. export JRUBY_HOME=/usr/local/share/jruby
|
||||
# for all commands, CLASSPATH and HBASE_OPTS are updated according to JRUBY_HOME specified
|
||||
# (2) when JRUBY_HOME is not specified explicitly
|
||||
# A. for jruby_cmds defined below, add JRUBY_PACKAGED_WITH_HBASE into CLASSPATH
|
||||
# B. for other commands, do nothing
|
||||
# (1) for the commands which need jruby (see jruby_cmds defined below)
|
||||
# A. when JRUBY_HOME is specified explicitly, eg. export JRUBY_HOME=/usr/local/share/jruby
|
||||
# CLASSPATH and HBASE_OPTS are updated according to JRUBY_HOME specified
|
||||
# B. when JRUBY_HOME is not specified explicitly
|
||||
# add jruby packaged with HBase to CLASSPATH
|
||||
# (2) for other commands, do nothing
|
||||
|
||||
if [ "$JRUBY_HOME" != "" ]; then # JRUBY_HOME is specified explicitly, eg. export JRUBY_HOME=/usr/local/share/jruby
|
||||
# check if the commmand needs jruby
|
||||
declare -a jruby_cmds=("shell" "org.jruby.Main")
|
||||
for cmd in "${jruby_cmds[@]}"; do
|
||||
if [[ $cmd == "$COMMAND" ]]; then
|
||||
jruby_needed=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# the command needs jruby
|
||||
if [[ $jruby_needed ]]; then
|
||||
if [ "$JRUBY_HOME" != "" ]; then # JRUBY_HOME is specified explicitly, eg. export JRUBY_HOME=/usr/local/share/jruby
|
||||
# add jruby.jar into CLASSPATH
|
||||
CLASSPATH="$JRUBY_HOME/lib/jruby.jar:$CLASSPATH"
|
||||
|
||||
# add jruby to HBASE_OPTS
|
||||
HBASE_OPTS="$HBASE_OPTS -Djruby.home=$JRUBY_HOME -Djruby.lib=$JRUBY_HOME/lib"
|
||||
|
||||
else # JRUBY_HOME is not specified explicitly
|
||||
# check if the commmand needs jruby
|
||||
declare -a jruby_cmds=("shell" "org.jruby.Main")
|
||||
for cmd in "${jruby_cmds[@]}"; do
|
||||
if [[ $cmd == "$COMMAND" ]]; then
|
||||
jruby_needed=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# add JRUBY_PACKAGED_WITH_HBASE to CLASSPATH when jruby is needed
|
||||
else # JRUBY_HOME is not specified explicitly
|
||||
# add jruby packaged with HBase to CLASSPATH
|
||||
JRUBY_PACKAGED_WITH_HBASE="$HBASE_HOME/lib/ruby/*.jar"
|
||||
if [[ $jruby_needed ]]; then # the command needs jruby
|
||||
for jruby_jar in $JRUBY_PACKAGED_WITH_HBASE; do
|
||||
CLASSPATH=$jruby_jar:$CLASSPATH;
|
||||
done
|
||||
|
|
|
@ -263,31 +263,35 @@ if defined service_entry (
|
|||
)
|
||||
|
||||
@rem for jruby
|
||||
@rem (1) when JRUBY_HOME is defined
|
||||
@rem for all commands, CLASSPATH and HBASE_OPTS are updated according to JRUBY_HOME specified
|
||||
@rem (2) when JRUBY_HOME is not defined
|
||||
@rem A. for jruby-commands defined below, add JRUBY_PACKAGED_WITH_HBASE into CLASSPATH
|
||||
@rem B. for other commands, do nothing
|
||||
@rem (1) for the commands which need jruby (see jruby-commands defined below)
|
||||
@rem A. when JRUBY_HOME is defined
|
||||
@rem CLASSPATH and HBASE_OPTS are updated according to JRUBY_HOME defined
|
||||
@rem B. when JRUBY_HOME is not defined
|
||||
@rem add jruby packaged with HBase to CLASSPATH
|
||||
@rem (2) for other commands, do nothing
|
||||
|
||||
@rem JRUBY_HOME is defined
|
||||
if defined JRUBY_HOME (
|
||||
set CLASSPATH=%CLASSPATH%;%JRUBY_HOME%\lib\jruby.jar
|
||||
set HBASE_OPTS=%HBASE_OPTS% -Djruby.home="%JRUBY_HOME%" -Djruby.lib="%JRUBY_HOME%\lib"
|
||||
@rem check if the commmand needs jruby
|
||||
set jruby-commands=shell org.jruby.Main
|
||||
for %%i in ( %jruby-commands% ) do (
|
||||
if "%hbase-command%"=="%%i" set jruby-needed=true
|
||||
)
|
||||
|
||||
@rem JRUBY_HOME is not defined
|
||||
if not defined JRUBY_HOME (
|
||||
@rem check if the commmand needs jruby
|
||||
set jruby-commands=shell org.jruby.Main
|
||||
for %%i in ( !jruby-commands! ) do (
|
||||
if "%hbase-command%"=="%%i" set jruby-needed=true
|
||||
@rem the command needs jruby
|
||||
if defined jruby-needed (
|
||||
@rem JRUBY_HOME is defined
|
||||
if defined JRUBY_HOME (
|
||||
set CLASSPATH=%JRUBY_HOME%\lib\jruby.jar;%CLASSPATH%
|
||||
set HBASE_OPTS=%HBASE_OPTS% -Djruby.home="%JRUBY_HOME%" -Djruby.lib="%JRUBY_HOME%\lib"
|
||||
)
|
||||
|
||||
@rem add JRUBY_PACKAGED_WITH_HBASE to CLASSPATH if jruby is needed
|
||||
@rem JRUBY_HOME is not defined
|
||||
if not defined JRUBY_HOME (
|
||||
@rem add jruby packaged with HBase to CLASSPATH
|
||||
set JRUBY_PACKAGED_WITH_HBASE=%HBASE_HOME%\lib\ruby\*
|
||||
if defined jruby-needed (
|
||||
set CLASSPATH=!JRUBY_PACKAGED_WITH_HBASE!;!CLASSPATH!
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@rem Have JVM dump heap if we run out of memory. Files will be 'launch directory'
|
||||
|
|
Loading…
Reference in New Issue