Symbian
Symbian OS Library

FAQ-0219 When I quit my Java application, the WINS emulator quits, too. Why is this?

[Index][spacer] [Previous]



 

Classification: Java Category: Emulator
Created: 05/26/99 Modified: 06/25/2001
Number: FAQ-0219
Platform: Not Applicable

Question:
When I quit my Java application, the WINS emulator quits, too. Why is this?

Answer:
This is by design. The emulator doesn't fully emulate all aspects of the target Symbian devices. One area which it doesn't attempt to emulate at all is native processes.
The Java VM is a port of the JavaSoft source code, which expects the VM to run in a separate process, and expects to terminate it by terminating that process without doing elaborate item-by-item deallocation of memory. This works fine for Symbian devices but not for WINS where the VM runs as a thread in the emulator process. Since there is no foolproof way to know which native threads should and shouldn't be shut down together with the VM, the only safe way to shut down the VM is to terminate the containing process. So the built-in behaviour of the emulator is that closing down a Java process always ends the emulator session.

This problem is manifested on platforms other than Symbian WINS emulation in the fact that the JNI invocation function DestroyJavaVM(...) will terminate the main thread of a VM started from native code but is not able to unload the VM (since to do so would necessarily involve terminating the host process).