If I understand the question, it's not that
UUIDGen.makeType1UUIDFromHost(InetAddress.getLocalHost()) is returning
duplicate UUID's.  It should always be giving unique time-based uuids
and has checks to make sure it does.  The question was whether it was
possible to get multiple unique time-based UUID's with the exact same
timestamp component, rather than avoiding duplicates in the timestamp
the way UUIDGen currently does.  The answer to that is that you could
take a look at the code for the UUIDGen class and create your own
version that perhaps generated the clock sequence in a different way,
such as leaving a certain number of low order bits of the clock
sequence empty and then incrementing those when duplicate timestamps
were generated rather than incrementing the timestamp the way UUIDGen
currently does.

On Wed, Mar 30, 2011 at 10:08 AM, Drew Kutcharian <d...@venarc.com> wrote:
> Hi Roshan,
> You probably want to look at Twitter's
> Snowflake: https://github.com/twitter/snowflake
> There's also another Java variant: https://github.com/earnstone/eid
> - Drew
>
> On Mar 30, 2011, at 6:08 AM, Roshan Dawrani wrote:
>
> Hi,
> Is there any way I can get multiple unique time UUIDs for the same timestamp
> value - I mean, the UUIDs that are same in their time (most significant
> bits), but differ in their least significant bits?
> The least significant bits added by
> me.prettyprint.cassandra.utils.TimeUUIDUtils seem to be a fixed value based
> on mac/ip address, which makes sure that I get the same UUID for a timestamp
> value, everytime I ask.
> I need the "(timestamp): <some value>" kind of columns that need to be
> sorted by time, and I wanted to use TimeUUID to use column sorting that
> comes out-of-the-box, but the problem is that I can get multiple values for
> the same timestamp.
> So, I am looking for some way where the time portion is same, but the other
> UUID half is different so that I can safely store "1 time UUID: 1 value".
> Any help there is appreciated.
> --
> Roshan
> Blog: http://roshandawrani.wordpress.com/
> Twitter: @roshandawrani
> Skype: roshandawrani
>
>
>

Reply via email to