Vaadin Touchkit 2.0: ThreadLocal problem

Hello,

i am porting my software from Vaadin Touchkit 1.0 to 2.0.
In version 1.0 I handled username and password in the
parameterHandler on startup. But in Touchkit 2.0 i have to
wait for the onBrowserDetailsReady() method to distinguish
between tablet or smartphone. The username and password
are stored in a ThreadLocal so that i can later access them.
Everything worked fine in V 1.0, but in V2.0 when I initialize my
UI from onBrowserDetailsReady() all ThreadLocals are null.
Does anybody know why?

Thx in Advance

If you are in a sub-thread (a thread started from a thread), check that the variables are InheritableThreadLocal – in spite of the name, this should pretty much be the default, but because of the name, we often see that the regular ThreadLocal is used, with unintended (bad) consequences.

Thanks,

i tried to change it to InheritableThreadLocal but nothing changes. The ThreadLocal is instantiated in the handleParameters method.
In Touchkit Version 1 everything worked fine.

I hope you noticed that there’s built-in ThreadLocal implementation in TouchKit 2.0. I’m not sure if it can interfere with your own ThreadLocals.

Thx,

can you please give me a more detailed description of the built-in ThreadLocals??

Hi,

It’s mentioned in the
TouchKit Tutorial
. I suppose it should be mentioned in the TouchKit chapter in the Book as well.

Thx,

reading the variables from the TouchkitApplication fixed my problem.

Hello!
How can I access application instances from event thread when thread local pattern is used to manage application instances?.
I always receive null because no application instances are associated with event thread. How can I handle that?
Thank you.