Re: t5.4 alert manager cannot be used in thread...

2014-11-11 Thread Lance Java
Note, there's only actually one PerThread service here which is RequestGlobals. All other services (Request, Response, ApplicationStateManager) point to this service. So, if you initialize RequestGlobals your async worker should be OK. You might be able to do the Following. public class SomePage

Re: t5.4 alert manager cannot be used in thread...

2014-11-11 Thread Lance Java
Both the Environment and the Request are PerThread services. As I said, the services themselves are singletons / proxies. It doesn't matter how you pass around the services, they won't work on a non-request thread. The AlertManager points to the ApplicationStateManager which manages the session. Th

Re: t5.4 alert manager cannot be used in thread...

2014-11-10 Thread Paul Stanton
Hi Lance, Yes what you say is true, however to make the AlertManager compatible with asynchronous usage (ie the request/response is gone but the session is still a valid context) the code could simply change from: if (request.isXHR()) (and removing the Request field) to R

Re: t5.4 alert manager cannot be used in thread...

2014-11-08 Thread Lance Java
The Request and Response are PerThread services meaning the service is actually proxy which passes through to a PerThreadValue. This PerThread value will be null on a non-request thread. There's a few approaches to work around this including: 1. Pass values from the request thread to the worker on

t5.4 alert manager cannot be used in thread...

2014-11-05 Thread Paul Stanton
Hi, i'm not sure if this is worth logging as a Jira or if i've missed the point.. please advise. I'm adding an alert via alertManager in an inner thread. void onSomething() { final AlertManager fAlerts = alerts; new Thread() { public void run() { do