jboss启动时java VM参数设置

jboss服务器中jvm参数的设置:

在$JBOSS_HOME/bin下的run.sh里面存在这么一个设置:

# Force IPv4 on Linux systems since IPv6 doesn't work correctly with jdk5 and lower
if [ "$linux" = "true" ]; then
   JAVA_OPTS="-Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
fi
 

该参数就是设置java VM的参数。我们可以在这里修改这个参数;但更一般的我们会在run.conf里面单独设置java VM的参数,而在这边进行引用。

上面的可以做如下修改

# Force IPv4 on Linux systems since IPv6 doesn't work correctly with jdk5 and lower
# if JAVA_OPTS is not setted in run.conf, setting  here; by djq
if [ "x$JAVA_OPTS" = "x" ]; then
   JAVA_OPTS="-Xms128m -Xmx512m -XX:PermSize=64m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=36000"
fi
if [ "$linux" = "true" ]; then
   JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
fi
 

而我们需要可以在run.conf里面单独设置java VM的参数了。(一般情况下我们也不需要在run.sh里面做任何修改,只要在run.conf里面确保该有的参数都有了就ok了)。

附:

run.conf的一个设置:

## -*- shell-script -*- ######################################################
##                                                                          ##
##  JBoss Bootstrap Script Configuration                                    ##
##                                                                          ##
##############################################################################

### $Id: run.conf 62747 2007-05-02 17:43:36Z [email protected] $

#
# This file is optional; it may be removed if not needed.
#

#
# Specify the maximum file descriptor limit, use "max" or "maximum" to use
# the default, as queried by the system.
#
# Defaults to "maximum"
#
#MAX_FD="maximum"

#
# Specify the profiler configuration file to load.
#
# Default is to not load profiler configuration file.
#
#PROFILER=""

#
# Specify the location of the Java home directory.  If set then $JAVA will
# be defined to $JAVA_HOME/bin/java, else $JAVA will be "java".
#
#JAVA_HOME="/opt/java/jdk"
#set JAVA_HOME here; by djq
JAVA_HOME="/jboss/jdk1.5.0_22"

#
# Specify the exact Java VM executable to use.
#
#JAVA=""

#
# Specify options to pass to the Java VM.
#
#if [ "x$JAVA_OPTS" = "x" ]; then
#   JAVA_OPTS="-Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
#fi

# set options for the JVM; by djq
if  [ "x$JAVA_OPTS" = "x" ]; then
   JAVA_OPTS="-Xms1024m -Xmx6120m -XX:PermSize=128m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=36000"
fi

# Sample JPDA settings for remote socket debuging
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"

# Sample JPDA settings for shared memory debugging 
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=jboss"
 

猜你喜欢

转载自shuidexiongdi.iteye.com/blog/1480169