Hi Balvinder, The most simplest way would be to have two documents. Perform a dummy update on the first, read the second doc after that, increment the number you got from the second, and update the second doc with the new number. The dummy update will cause a transaction long write lock on the first document, which causes automatic synchronisation. You will need to do the update first, as reading the second doc will not prevent it being updated or read by others..
Kind regards, Geert > drs. G.P.H. (Geert) Josten Consultant Daidalos BV Hoekeindsehof 1-4 2665 JZ Bleiswijk T +31 (0)10 850 1200 F +31 (0)10 850 1199 mailto:[email protected] http://www.daidalos.nl/ KvK 27164984 P Please consider the environment before printing this mail. De informatie - verzonden in of met dit e-mailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. > From: [email protected] > [mailto:[email protected]] On Behalf Of > SinghDang, Balvinder (ELS-OXF) > Sent: donderdag 15 april 2010 16:04 > To: [email protected] > Subject: [MarkLogic Dev General] Unique Sequence Id > > Hi All, > We have a requirement to generate unique sequence id, and we > are planning to implement it using an id sequence as a > database document (XML based counter), i.e. store a sequence > number in an XML file and increment it each time it is > invoked, but how do we achieve synchronization (like Java > synchronization), so that multiple threads can access this > counter and generate a unique id for every call to the function? > > Thanks, > Balvinder Dang > > Elsevier Limited. Registered Office: The Boulevard, Langford > Lane, Kidlington, Oxford, OX5 1GB, United Kingdom, > Registration No. 1982084 (England and Wales). > > _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
