Sorry, subject should be wrap() method, not runAs().

On Tue, May 25, 2010 at 9:33 AM, James Carman
<[email protected]> wrote:
> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to