Grokbase Groups Cayenne dev May 2007
ThreadLocal bound DataContext is not obtainable in a multi-thread for a request environment such as ZK

Key: CAY-791
Project: Cayenne
Issue Type: Bug
Components: Cayenne Core Library
Affects Versions: 2.0 [STABLE], 3.0
Environment: ZK Ajax framework and any other multi-thread per request environment
Reporter: Steve Wells
Assigned To: Andrus Adamchik

Having hit my first roadblock now is getting DataContext, as each ZK request runs in a separate thread (see: ) I think this is the problem why I can't get DC with WebApplicationContextFilter and DataContext.getThreadDataContext (). I get "IllegalStateException: Current thread has no bound DataContext."

Looking into src for DataContext I see this comment // TODO: Andrus, 11/7/2005 - should we use InheritableThreadLocal instead?

So I subclassed DataContext and overrode the :
ThreadLocal threadDataContext

to be

InheritableThreadLocal threadDataContext

changed WebApplicationContextFilter to call my subclassed DataContext and it works.

HOWEVER! This possible solution may be dangerous and currently needs more investigation.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
postedMay 21, '07 at 8:33a
activeMay 21, '07 at 8:33a

1 user in discussion

Anonymous: 1 post



site design / logo © 2022 Grokbase