Code review request for 7049774

David Holmes David.Holmes at
Thu Jun 9 21:15:34 UTC 2011

Hi Chris,

Chris Hegarty said the following on 06/10/11 02:05:
> I looks like this change may break the UID spec.
> "# time, a long equal to a time (as returned by 
> System.currentTimeMillis()) at which the VM that this UID was generated 
> in was alive, or zero for a well-known UID  "
> 'time' may no longer be equal to currentTimeMillis.

We should have added you to the conversation when a number of us 
discussed this. It doesn't actually say the the time field must be equal 
to the current value of currentTimeMillis, only that it must be a value 
of currentTimeMillis at which point the VM was alive. When time jumps 
backward we are in a bind because we want to preserve uniqueness even 
though the spec says uniqueness is not guaranteed in this case. By 
manually advancing the time we preserve uniqueness, don't "hang" waiting 
for the apparent time to advance, but play a little loose with the 
correlation of the time value.

> It looks like count is incremented for every UID created. I wonder if it 
> may only be necessary to increment count if there is another UID created 
> with the same time. This would allow a much larger number of UID's to be 
> created before encountering the issue you are seeing?

Right this was my reading of the spec too. We could/should be able to 
create 64K UIDs per millisecond. The problem is that if we check 
currentTimeMillis on every construction then performance will be abysmal.


> I'm guess that this change is actually targeted to jdk8, rather than the 
> 'compare against' gate shown in the webrev.
> -Chris.
> On 06/ 9/11 04:26 PM, Seán Coffey wrote:
>> 7049774 : UID construction appears to hang if time changed backwards
>> I'm looking for code review of above reported issue. If system clock goes
>> backwards on rmi server with active clients and 64k UID boundary is hit,
>> the server will wait until system time progresses past the time at which
>> UID class
>> was instantiated.
>> Fix is to not to use earlier times for such corner cases.
>> bug ID should become public on over coming day.
>> webrev :
>> Regards,
>> Sean.

More information about the core-libs-dev mailing list