-
Notifications
You must be signed in to change notification settings - Fork 19
REPL
Nils Kilden-Pedersen edited this page Mar 18, 2016
·
4 revisions
Hazelcast requires all class files to be shared between cluster members and clients, due to the nature of the JVM, which is a compiled environment. However, this is often cumbersome, particularly during development, since it requires redeploy of class files and cluster restart.
However, using the -Yrepl-outdir
feature of the Scala REPL in combination with the serializers defined in DynamicExecution
, we can execute arbitrary code from the REPL to a running Hazelcast cluster.
To enable this, all cluster members (and any clients) must register the dynamic serializers, like this:
serialization.DynamicExecution.register(conf.getSerializationConfig)
Then it's simply a matter of invoking the REPL with -Yrepl-outdir
and making sure the directory is on the classpath, something like this:
OUTDIR=$TEMP/hazelcast-scala_repl-classes/$(date +"%s")
mkdir -p $OUTDIR
CP="$OUTDIR:<other jars>"
scala -cp $CP -Yrepl-outdir $OUTDIR