Why not just "collect" the information you need and pass it to the thread? Can't you know in advance which localized values you are going to need?
Best, Ernesto On Wed, Feb 10, 2010 at 12:08 PM, Matthias Keller <matthias.kel...@ergon.ch>wrote: > Hi > > We have a complex application which needs to calculate some very expensive > things. Those could easily be parallelized so we thought about having a > thread pool to do that. > Unfortunately, that code needs access to the localizer and the application > (for some configuration values) so we're setting the Session and the > Application explicitly in that thread using Application.set() and > Session.set(). > But this always leads to a strange error - I suspect it has something to do > with the 'duplicated' session or application? > > Any hints about how to do this correctly? Do we need to do something > special with the session or application at the end of the thread? > > Thanks! > > Matt > > > Here's the stacktrace: > > WicketMessage: Method onFormSubmitted of interface > org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component > [MarkupContainer [Component id = SignupForm]] threw an exception > > Root cause: > > ExceptionConverter: java.io.IOException: No message found for > the.document.has.no.pages > > Complete stack: > > org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of > interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at > component [MarkupContainer [Component id = SignupForm]] threw an exception > at > org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:194) > at > org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73) > at > org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91) > at > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1175) > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1252) > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353) > at org.apache.wicket.RequestCycle.request(RequestCycle.java:493) > at > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:355) > > java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at java.lang.reflect.Method.invoke(Method.java:597) > at > org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:183) > at > org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73) > at > org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91) > at > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1175) > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1252) > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353) > at org.apache.wicket.RequestCycle.request(RequestCycle.java:493) > at > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:355) > > > >