saidone.org -
use only under adult supervision
Main menu
Development
Mailing lists
About

Swamp
Links
ush.it
aghers.org
saidone@ush
gameknot
virtualmagister

Misc
JBoss run.conf Alfresco JAVA_OPTS reminder - posted by saidone on Thu, 23 Apr 2009 20:53:03 GMT
Very simple JBoss run.conf with JVM tuning parameters on separate lines, each one of which can be commented and/or host a comment itself.

IMHO far better than having all the switches on one line, so I can fast toggle them on or off and keep an eye on the overall configuration, especially with 80 columns terminals, thus avoiding line wraps.

This is a bash script that make use of a "here document" and some sed substitutions.
The syntax seems self explanatory enough, so here's the code:
if [ "x$JAVA_OPTS" = "x" ]; then
	J_OPTS=$(cat <<-EOF
	-server	# use the server vm
#	-Xcomp					# precompilation
#	-Xbatch					# precompilation
	-Xss1024k				# stack size for each thread
	-Xms512m				# initial heap size
	-Xmx512m				# maximum heap size
	-XX:MaxPermSize=128m			# permanent generation size
	-XX:NewSize=256m			# young generation size
	-XX:+UseConcMarkSweepGC			# garbage collection behaviour
	-XX:+CMSIncrementalMode			# garbage collection behaviour
	-XX:CMSInitiatingOccupancyFraction=80	# garbage collection behaviour
	-Dsun.rmi.dgc.client.gcInterval=3600000
	-Dsun.rmi.dgc.server.gcInterval=3600000
	EOF
	)

	IFS=$'\n'
	for LINE in $J_OPTS; do
		JAVA_OPTS=$JAVA_OPTS$(echo -n $LINE |
		# remove leading whitespaces
		sed 's/^[ \t]*//' |
		# remove comment lines
		sed '/^[ \t]*#.*$/d' |
		# remove trailing whitespaces and comments
		sed 's/[ \t].*$//' |
		# remove blank lines
		sed '/^$/d' | 
		# add a single space before the parameter
		sed 's/^/ /'
		)
	done
fi

echo $JAVA_OPTS;




No comments yet.



Post a new comment

<-- comment title (well, not really mandatory)
<-- your name
<-- your e-mail
<-- add 2933 to 128

back to home
[[[[[[[ served by kugelmass ]]]]]]]
I don't believe in psychology. I believe in good moves. - Bobby Fischer