Closed ghost closed 9 years ago
Yes. It's current JVM's restriction.
according to http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4712793
once a VM is created and destroyed, one cannot start another VM
Therefore if Rjb invoked DestroyJVM by unload, then Rjb never succeeded to create JVM. By the way, I wonder if you could explain me why do you like to unload and reload JVM ?
ok. My usecase is to kill java global(singleton) instances. details: I'm creating a testing framework for ApachePig(http://pig.apache.org/ Hadoop's DSL.) by using rjb. The language implementation have global context. Therefore, Killing jvm after a test case is little better to test separation.(It's NOT necessary, but better.)
oh... > JNI bug. Thanks for your explanation. I try to another way.
Hi, thank you for you explanation. There are some way to do destroy singleton. One major way is to create it on a certain ClassLoader (for example, Tomcat's webapp context is separated from another context that's because ClassLoader is different (based on own WEB-INF) ). It's hard way but technically interesting. You may create new ClassLoader per a test and load the singleton on it.
very thanks! I'll try to create some loader.
Can't reload JVM. sample is following.
line 8 occurs a error "in `load': can't create Java VM (RuntimeError)".
Environment: rjb 1.5.1.