scala - Get command line arguments when running an Akka Microkernel? -
i have akka microkernel below:
class servicekernel extends bootable { val system = actorsystem("service-kernel") def startup = { system.actorof(props(new boot(false))) ! start } def shutdown = { system.shutdown() } }
because kernel extends bootable
, not app
, how access command line arguments used when starting kernel? instance if run kernel using start namespace.servicekernel -d rundevmode
or similar. thanks!
additional info
i thought worth adding information start script in microkernel. in /bin/start
notice following:
#!/bin/sh akka_home="$(cd "$(cd "$(dirname "$0")"; pwd -p)"/..; pwd)" akka_classpath="$akka_home/config:$akka_home/lib/*" java_opts="-xms256m -xmx512m -xx:+useconcmarksweepgc -xx:+cmsclassunloadingenabled -xx:parallelgcthreads=2" java $java_opts -cp "$akka_classpath" -dakka.home="$akka_home" akka.kernel.main "$@"
although om-nom-nom suggested -d
options, looks it's in use , main start parameter being passed akka.kernel.main
class (which in case servicekernel
class above).
here minimal example:
object foo extends app { val debugmodeon = system.getproperty("debugmode") != null val msg = if (debugmodeon) "in debug mode" else "not in debug mode" println(msg) } » scala foo -ddebugmode in debug mode » scala foo not in debug mode
you can check overcome issue:
» scala foo -ddebugmode=false in debug mode
p.s. might want use properties helper, contains bunch of methods propornone, proporelse, etc
Comments
Post a Comment