[concurrency-interest] Re: Thread.getId()

Larry Riedel larryr@saturn.sdsu.edu
27 Jan 2004 01:15:00 -0000


> > > public long getId()
> > > I think it should be prohibited for the jvm to reuse a thread id, I 
> > > simply can't see any reason why it should be allowed.
> 
> This clause seems to exist in order to handle the potential theoretical
> exhaustion of IDs.

If the ID was incremented every nanosecond, would it wrap
around in less than 100 years?  It seems pretty crazy
to me as well, especially since it would be trivial to
implement using AtomicLong.getAndAdd(). :-)  Maybe there
was a predecessor that returned an int?


Larry