The disadvantage of sharedCounters is that they are not made persistent when the system is stopped and restarted. (Another disadvantage is that they are local to the host and not shared across multiple hosts--though the free license does not provide for multiple hosts so this is not a GLASS problem.)
I'd suggest you investigate the Persistent Counters method category in the System class. They are much like the sharedCounters, but persistent.
James
On May 5, 2011, at 10:25 AM, Nick Ager wrote:
> Hi,
>
> I want to generate a unique transaction id. I've considered a number of approaches:
>
> 1) Use Gemstone's shared counter functionality:
>
> System _sharedCounterFetchValuesFrom: 23 to: 23.
> System _sharedCounter: 23 setValue: 10.
> System _sharedCounter: 23 incrementBy: 1.
>
> 2) roll my own with a Mutex.
> 3) Use a UUID
>
> I'm inclined to go with a UUID as there's no need to initialise it and it works across dialects, although I sacrifice readability.
>
> Any thoughts?
>
> Nick
>
>
>
>