Threading Advice

Posts   
 
    
beekde
User
Posts: 14
Joined: 08-Jul-2005
# Posted on: 17-Oct-2005 21:49:20   

I am trying to understand best practices for implementing threads.

My application basically needs to synchronize several Entities through webservice calls. The Entities are (for the most part) isolated from each other. I would like to do this in a threaded manner, executing several webservice calls simultaneously and updating this entities within those threads. I have one dataaccessadapter and while doing this keep getting "There is already an open DataReader associated with this Connection which must be closed first.". Does anyone have advice on how to use a single instance of Adapter among several simultaneous threads? Should there be lock statements within the adapter to prevent this from occuring?

JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 18-Oct-2005 03:31:09   

beekde wrote:

Does anyone have advice on how to use a single instance of Adapter among several simultaneous threads? Should there be lock statements within the adapter to prevent this from occuring?

I don't think so, because the adapter is not mult-thread safe. I believe (someone correct me if I'm wrong) that is precisely because it uses a data reader, and you've seen that a single connection can only have one reader open at a time.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 18-Oct-2005 10:08:50   

DataAccessAdapter isn't thread safe indeed.

Frans Bouma | Lead developer LLBLGen Pro