Mittwoch, 29. Juni 2011

AppContext for rescue

Yesterday I had a talk with Roman and Mario about AppContexts, and it turns out to be really useful.
Basically AppContexts are used inside AWT to shield one application/applet from others, create seperate Event-Dispatch-Threads for each app and so on.

Originally introduced for Applets I guess, this is exactly what I was looking for. Furthermore it solves the problem of out-of-http-request access to the surface. During an http-access I of course now which session I am on - but what if an application starts its own threads? Well, now each app knows its Session, as its stored in its AppContext.

It also allows for multiple LnFs set in the same server:


mcloud hat gesagt…

Careful there. Last time I checked, the implementation of AppContext where quiet a mess. Plus I broken my head trying to get rid of the "last windows image" cache AWT/Swing builds there that keeps holding memory and never releases it ever again. Nasty.

Linuxhippy hat gesagt…

do you mean the image held by the double-buffering manager (forgot how its called)?

mcloud hat gesagt…

Yeah, something like that. It uses a width x height x 32 pixmap accourding to the last shown window or something. Usually the windows is maximized, so that's a lot of memory. It may looks not too much, but think of Terminal server users where you get like 50 users in the same windows box running your app

KI hat gesagt…

I tried once to make Swing app framework which uses multiple AppContexts to manage multiple separate sessions in same JVM:

However, sad fact was that I had to discard design, due to few showstopper problems. (1) There is bugs in AWT/Swing, which caused rendering bugs (and possibly some other problems also, don't recall anylonger), (2) JRE compatibility, between different implementations.

Linuxhippy hat gesagt…

KI: Interesting. Do you remember what kinds of painting bugs you encourntered?

As far as I know applets do the same - start an EDT for each instance althrough they are (by default) running in the same JVM.