There are multiple races in class DatabaseImpl on the
field sqlInterface (defined in class DatabaseCore).
The problem is that the following methods in class
DatabaseImpl access sqlInterface without holding any lock:
delete
deleteForCriteria
insert
select
selectByPrimaryKey
update
updateForCriteria
All of the above methods access sqlInterface, for
instance, the delete method contains the statements:
sqlInterface = getCurrentSqlInterface(databaseName);
DeleteStatement deleteStat = new
DeleteStatement(view,null,sqlInterface);
If any two of the above methods are called in parallel,
then there will be a race on sqlInterface. I can think
of 2 possible solutions:
1. Synchronize all of the above methods on "this".
2. Make sqlInterface a local variable in each of the
above methods.
Note: Whatever solution you take, remember that there
is one access to sqlInterface in method createOID. It
is protected by holding a lock on "this", so if you
adopt solution (1) above, then no changes are needed in
createOID. But if you adopt solution (2), then pass
sqlInterface as an argument to createOID.
Logged In: YES
user_id=398550
it 's true. i think that best solution to fix this bug is 1 as you
have advice.