Hi, i stumbled across this, correct me if i'm wrong; suppose i have two webservers running the same webapp against the same database. Both webapp instances run in their own jvm, running their own instance of OJB. Using sequences, the sequence generator instances fetch and updat the sequences with the new max_key. However, their is no concurrency control! Both webapp instances may end up with the same sequence instance (same max_key, same currval) if sequence generators fetched the sequence concurrently at the same time, and thus be generating the same id's. A solution might be to use locking (set locking='true' in repository.xml) on the maxKey attribute of the sequence (i.e. only if my copy of the sequence is the most recent, i may update it). This way, only one of the generator instances will succeed in updating the sequence, the others will fail. Some exception handling should be introduced where concurrentmodifications are caught. Instead of directly failing, within a loop several retries could be issued (fetch new instances and try to update it again) so the getUniqueId method of a sequencemanager may still succeed. Only if even after several retries, we were not able to successfully (==correctly) update the sequence, getting a correct new id, an exception should be thrown.
************************************************************************* The information contained in this communication is confidential and is intended solely for the use of the individual or entity to whom it is addressed.You should not copy, disclose or distribute this communication without the authority of iBanx bv. iBanx bv is neither liable for the proper and complete transmission of the information has been maintained nor that the communication is free of viruses, interceptions or interference. If you are not the intended recipient of this communication please return the communication to the sender and delete and destroy all copies.
