首页 > 代码库 > jboss启动时java VM参数设置
jboss启动时java VM参数设置
jboss服务器中jvm参数的设置:
在$JBOSS_HOME/bin下的run.sh里面存在这么一个设置:
Java代码
- # 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的参数,而在这边进行引用。
上面的可以做如下修改
Java代码
- # 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的一个设置:
Java代码
- ## -*- shell-script -*- ######################################################
- ## ##
- ## JBoss Bootstrap Script Configuration ##
- ## ##
- ##############################################################################
- ### $Id: run.conf 62747 2007-05-02 17:43:36Z dimitris@jboss.org $
- #
- # 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"
jboss启动时java VM参数设置
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。