[Opensource] Upgrading from 4.02 to 5.02: DBObject question
Vincent Gogan
vincent.gogan at goganinc.com
Wed Jun 18 11:25:09 PDT 2003
Has there been a way that DBObject's cache? I ran into the following
difference
in behaviour.
I seem to have a DBObject that contains stale information.
In Thread 1:
DBSomeThing s = new DBSomeThing();
s.setField(FIELD_ID, n);
if (!s.find()) blowUp();
display(s.getField(FIELD_INFO));
performALengthyTask();
display(s.getField(FIELD_INFO));
Meanwhile, in another thread, executed while the first thread is performing
the lengthy task,
DBSomething s = new DBSomeThing();
s.setField(FIELD_ID, same_index);
if (!s.find()) blowUp());
s.setField(FIELD_INFO, new_value);
In 4.02, this code worked just fine and the first thread picked up the
change. In 5.02,
this breaks and the first thread can only acces the old/stale value. One
possible
contributing factor is that thread 1 may be using a derived class:
public class DBExtendedSomeThing extends DBSomeThing {
// Just overrides/adds some methods
}
and be actually using DBExtendedSomeThing in the above code.
Thanks,
Vincent
More information about the Opensource
mailing list