Strabon

changeset 621:2bfb0dc8cbf8

added -m (more memory) and -M (much more memory) in strabon script for out-of-memory exceptions
author Babis Nikolaou <charnik@di.uoa.gr>
date Thu Oct 04 21:29:36 2012 +0300 (2012-10-04)
parents db08c38e1422
children 4bb0fad95027
files scripts/strabon
line diff
     1.1 --- a/scripts/strabon	Thu Oct 04 18:42:57 2012 +0300
     1.2 +++ b/scripts/strabon	Thu Oct 04 21:29:36 2012 +0300
     1.3 @@ -65,6 +65,18 @@
     1.4  #-Dlog4j.debug
     1.5  #-Dlog4j.configuration=\"${RUNTIME}/log4j.properties\"
     1.6  
     1.7 +# further options for java
     1.8 +JAVA_OPTS=
     1.9 +
    1.10 +# more memory
    1.11 +MORE_MEMORY="-Xms512M -Xmx1024M"
    1.12 +
    1.13 +# much more memory
    1.14 +MMORE_MEMORY="-Xms512M -Xmx1536M"
    1.15 +
    1.16 +# flag for not setting the memory limit more than once
    1.17 +MEMORY_INCREASED=false
    1.18 +
    1.19  # just print what shall be executed
    1.20  DEBUG=false
    1.21  
    1.22 @@ -90,6 +102,8 @@
    1.23  	echo "	-d		: don't run, just print what shall be executed"
    1.24  	echo "			  Variable for configuration file: \`DEBUG'"
    1.25  	echo "			  Values: \`true' or \`false'" 
    1.26 +	echo "	-m		: use more memory \`${MORE_MEMORY}' (useful in \"out of memory exceptions\""
    1.27 +	echo "	-M		: use much more memory \`${MMORE_MEMORY}' (useful in \"out of memory exceptions\""
    1.28  	echo "	-i		: include URI prefixes in the SPARQL query. Prefixes are taken from file"
    1.29  	echo "			  \`prefixes.sparql'"
    1.30  	echo "	-e DATABASE	: the database engine to connect (one of \`postgis' (default) or \`monetdb')"
    1.31 @@ -185,6 +199,24 @@
    1.32  			DEBUG=true
    1.33  			DEBUG_SAVE=true
    1.34  			;;
    1.35 +		-m)
    1.36 +			if ! ${MEMORY_INCREASED}; then
    1.37 +				JAVA_OPTS="${JAVA_OPTS} ${MORE_MEMORY}"
    1.38 +				MEMORY_INCREASED=true
    1.39 +			else
    1.40 +				echo "${CMD}: memory has already been increased; option \`${1}' will be ignored."
    1.41 +			fi
    1.42 +			shift
    1.43 +			;;
    1.44 +		-M)
    1.45 +			if ! ${MEMORY_INCREASED}; then
    1.46 +				JAVA_OPTS="${JAVA_OPTS} ${MMORE_MEMORY}"
    1.47 +				MEMORY_INCREASED=true
    1.48 +			else
    1.49 +				echo "${CMD}: memory has already been increased; option \`${1}' will be ignored."
    1.50 +			fi
    1.51 +			shift
    1.52 +			;;
    1.53  		-i)
    1.54  			shift
    1.55  			PREFIXES="$(cat ${PREFIXES_FILE})
    1.56 @@ -505,11 +537,11 @@
    1.57  			file="$(pwd)/${file}"
    1.58  		fi
    1.59  
    1.60 -		STRABON_EXEC="${STRABON_EXEC}(cd ${RUNTIME} && java -cp ./target/\*:. ${PKG}.${DATABASE}.${CLASS} ${HOST} ${PORT} ${DB} ${DBUSER} ${DBPASS} \"${file}\" ${FORMAT});
    1.61 +		STRABON_EXEC="${STRABON_EXEC}(cd ${RUNTIME} && java ${JAVA_OPTS} -cp ./target/\*:. ${PKG}.${DATABASE}.${CLASS} ${HOST} ${PORT} ${DB} ${DBUSER} ${DBPASS} \"${file}\" ${FORMAT});
    1.62  "
    1.63  	done
    1.64  else
    1.65 -	STRABON_EXEC="(cd ${RUNTIME} && java -cp ./target/\*:. ${PKG}.${DATABASE}.${CLASS} ${HOST} ${PORT} ${DB} ${DBUSER} ${DBPASS} \"${PREFIXES}${QUERY}\" ${RESULT_FORMAT})"
    1.66 +	STRABON_EXEC="(cd ${RUNTIME} && java ${JAVA_OPTS} -cp ./target/\*:. ${PKG}.${DATABASE}.${CLASS} ${HOST} ${PORT} ${DB} ${DBUSER} ${DBPASS} \"${PREFIXES}${QUERY}\" ${RESULT_FORMAT})"
    1.67  fi
    1.68  
    1.69  # execute command or debug