<Swing Dev> Is the following code supposed to leak?

Roman Kennke roman at kennke.org
Wed Aug 24 12:34:46 UTC 2011


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 ;-)

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?

Roman





More information about the swing-dev mailing list