On Thu, Apr 4, 2013 at 2:56 PM, Martin Dietze <[email protected]> wrote:

> On Thu, April 04, 2013, Martin Grigorov wrote:
>
> > You can pass the application name (application.getName()) to the manually
> > started threads and later use it to lookup the Application when needed:
> > Application.get(appName).
> >
> > If you can understand Scala then you can use
> >
> https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/scala-extensions-parent/wicket-scala/src/main/scala/org/wicketstuff/scala/FutureModel.scala#L53
> > as
> > inspiration.
>
> Thanks, the 'detach()' call was useful.
> However it seems like I have now found out what my main mistake
> was. I obviously did not fully understand how Applications are
> created.
>
> When I create my own dummy application, I need to make sure that
> I choose a name different from what the Wicket filter I have
> configured in my web.xml uses, as that one will run into an
> exception when setting the name to a value for which there
> already is an application.
>
> Thus (in rough steps) my code now looks like this:
>
> 1. check if an Application is set, if yes, everything's fine
> 2. if not, check if a dummy Application with a given
>    dummy-application-name exists, if no, create it under that
>    name
> 3. set the dummy application in the ThreadContext
> 4. do your work
> 5. clean up the ThreadContext using 'detach()'
>
> This way my code seems to work. Anything else that I
> misunderstood?
>
>
This should be OK.
Usually there is no need to create a dummy application - you can just
lookup the existing application by name.


> Cheers,
>
> M'bert
>
> --
> ----------- / http://herbert.the-little-red-haired-girl.org /
> -------------
> =+=
> The only "intuitive" interface is the nipple. After that, it's all
> learned.  -- Bruce Ediger
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Reply via email to