db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amir Michail" <amich...@gmail.com>
Subject handling race conditions
Date Tue, 09 Jan 2007 18:16:30 GMT
Hi,

I was wondering how one should handle race conditions.

My problem has to do with generating ids. I suppose that generating
ids using derby's auto generation does not result in any problems with
respect to race conditions.

However, in my case, I use a pair of items (x, y) where y starts
counting at 1 for each x. So you can have a race condition where both
threads see the same value of y and end up computing the same
subsequent id of y+1.

How is something like this normally handled in derby db so as to
maximize concurrency?

I'm using manual transactions btw.

Amir

Mime
View raw message