[infinispan-dev] [Discussion] TimeService implementation

Mircea Markus mmarkus at redhat.com
Fri May 3 12:00:31 EDT 2013


On 3 May 2013, at 16:54, Pedro Ruivo wrote:

> On 05/03/2013 04:49 PM, Manik Surtani wrote:
>> 
>> On 2 May 2013, at 19:01, Pedro Ruivo <pedro at infinispan.org> wrote:
>> 
>>> 
>>> preciseTime() {return (cached = System.nanoTime());}
>>> impreciseTime() {return cached;}
>> 
>> How would you invalidate the cached time?
> 
> My idea is to have a schedule thread updating the cached time. the 
> preciseTime() is just an optimization to keep the cached value more 
> up-to-date since we are calculating the nanoTime() (and assuming that 
> nanoTime() is more expensive than write in the volatile variable).

Sounds like a good idea but please don't implement that for now. That's a performance optimisation and would require benchmarking to prove it's worth doing - more of a nice to have ATM.

Cheers,
-- 
Mircea Markus
Infinispan lead (www.infinispan.org)







More information about the infinispan-dev mailing list