Hi,

Unless you use Servlet 3.0 Async there is only one thread that serves the
request. Wicket Page processing doesn't support async servlets. Wicket
Resources do support it.
But even if there are several requests (e.g. to Wicket Resources) then all
of them would have their own ThreadLocals and be able to access the
session. Just make sure the access is synchronized.

If this doesn't answer your question then please explain in more details
your use case.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Oct 13, 2015 at 11:21 AM, santhosh <[email protected]>
wrote:

> I have a doubt in ThreadLocal usage for managing session in wicket:
>
> There might be many threads which run to complete a single user request. In
> Thread Local, which ever thread that creates the thread local object has
> the
> access to that session object, and only that thread can modify the session
> object. So what about all other threads that participate to complete one
> user request. They wont get access to modify the session object, as
> whichever thread creates the Thread local object gets its own session
> object, so other threads that run to complete a single user request might
> not update their data to the session object they wanted to.
>
> I mean if thread-1 and thread-2 participate in completing a user request,
> but thread-1 comes to create the threadlocal object, and thread-2 executes
> other codes as part of the request, but after thread-2 completion , it cant
> update the session data because, only thread-1 has access to the session as
> it has created the threadlocal object.
>
> So how are we resolving this issue.
>
> Are we making sure that only one thread participate in completeing single
> users request ? or
>
> How are we so sure that which ever thread that creates the threadlocal
> object is only coming to update the session data associated for that
> request
> every time ?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/ThreadLocal-usage-for-managing-session-in-Wicket-tp4672215.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to