Hi Roman,
Hi all,
The vm doesn't terminate.
One VM to rule them all: the instances are separated via the
appcontext, but there is just one server vm running.
I'm not sure that's correct behavior. According to javadoc of
java.lang.System#exit: "Terminates the currently running Java Virtual
Machine.".
We are running the Notepad in a slightly different context: we run the
app on a server machine and send all the rendering (Java2D, etc) to the
browser which renders on an HTML5 canvas. Example:
http://icedrobot.de:9091/SessionInitializer?cls=SwingSet2
In such a (very unusual) setting, we don't terminate the VM. User
sessions are separate by AppContext, and we run many instances of the
app inside one VM. We never let the user terminate the VM (since that
would kill the VM for all users). We know that this is not the kind of
usage that AWT was designed for, but we like to push Java to the borders
and boldly go where no AWT has gone before ;-)
So if your SecurityManager denies app closing, then the application
should be alive. It looks that your implementation contradicts javadoc
contracts.
Besides, I find it a bit weird that addXZYListener() secretly registers
listener to some sort of internal global object. That sounds very leaky.
Is it documented that such listeners must always be carefully removed?
Or am I missing something?
As I said normally listeners shouldn't be removed manually, until this
listeners are added to static instances (or delegates). The
JTextComponent#getActions method invoked on non-static object, but it
uses inside static editor kit. So listener removing depends on
implementation and programmers should take such nuances into account.
Regards, Pavel