There was a long discussion about this. One of the proposal was to use
InheritableThreadLocal which would solve this problem, but there was a lot
of concerns about this approach.
The solution I have found was this:
If you create the thread with ExecutorService, you could do the following:
final ExecutorService service = new ScheduledThreadPoolExecutor(1) {
@Override
protected void beforeExecute(final Thread t, final Runnable r) {
Application.set(app);
};
@Override
protected void afterExecute(final Runnable r, final Throwable t) {
Application.unset();
}
};
and execute you thread like this:
service.submit(new Runnable() {
@Override
public void run() {
//do stuff
}
});
This will ensure that Application is accessible from within newly created
thread.
Alex
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Localizer-in-a-new-Thread-tp2307306p2307732.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]