I've been thinking about this whole idea of needing to access the
application object in different threads idea.  What if the Application
class had a method like this:

public Runnable wrap(Runnable task)

Basically, the Application would create a Runnable object that can be
run within the context of itself (by setting/clearing the ThreadLocal
variable).  Then, you can use that Runnable anywhere to run a task
with all of the appropriate Wickety goodness set up for you (except
for the request cycle of course because you're not executing within a
request cycle).  Now, what the Application stores in the Runnable
doesn't have to be the Application itself.  We can set up a static
Map<String,WeakReference<Application>> object on the Application class
and when an Application is constructed, it registers itself (the key
could be a UUID.randomUUID().toString()).  Then, we could have a
method like

public static Application get(String id);

on the Application class to get back the original Application object.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to