Hi.
There's a discussion of a similar issue on TheServerSide
(http://theserverside.com/patterns/thread.jsp?thread_id=220). Deep in
the discussion there is a link to a useful article
(http://www.sdmagazine.com/articles/1999/0012/0012p/0012p.htm?topic=uml).
This article and the discussion on TheServerSide are specifically
addressing the generation of primary keys for entity beans, but I
believe the high/low technique is applicable to your problem.
Regards,
Toby.
Krishna Kumar wrote:
>
> Hi folks
> i am sure this has been discussed before if so please point me to the
> correct thread / message,
> Recently i came across a peculiar problem we have several transactions which
> required sequence number , now this number has to be generated and handed
> out fast enough!!! So it kind of rules out putting it in a db and
> accessing it!!!
>
> So i hit upon a simple solution of putting a sequence number in a hash table
> and looking up the number whenever i required one!!
>
> The situation was okie with a few users but with a few more users it was no
> more thread safe!!! So i synchronised on the method...
>
> Now how do i do the following
> 1) Make it instance safe as more than one bean could be in my pool and they
> could do a update it and lead to dirty reads??
> 2) How do i make sure it is cluster safe??
> 3) How do i ensure even if the server goes down the last value of the
> transaction number gets saved in the db and i can start afresh from there
> on!!!
> 4) I am trying to do a sequence number in Oracle a) becos it is database
> specific
> b) the overhead and contention on it will be quite high!!
>
> Is there any other approach , please let me in how u folks go about it
> normally...
>
> warm regards
> Many thanks in advance
>
> krishna kumar
--
Toby Allsopp
Research
Peace Software International Ltd
Ph +64-9-3730400
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]