Bela Ban created JGRP-1763:
------------------------------
Summary: TimeService
Key: JGRP-1763
URL:
https://issues.jboss.org/browse/JGRP-1763
Project: JGroups
Issue Type: Feature Request
Reporter: Bela Ban
Assignee: Bela Ban
Fix For: 3.5
New service which provides wall clock time at a coarse (configurable) granularity.
Motivation: {{System.currentTimeMillis()}} or {{System.nanoTime()}} is sometimes called
frequently, e.g. by {{TCPConnectionMap$TCPConnection.updateLastAccessed()}} or in
FD/FD_ALL. This has a cost, especially when a lock is held (system calls while a lock is
held cause preemption and the thread losing its time slice).
However, the 2 examples above don't need the exact time, but an approximation of it is
OK.
GOALS:
* Provide a time service which returns the last cached value of
{{System.timeCurrentMillis()}}
* This is a quick and efficient call
* {{TimeService}} registers a timer task which updates its internal cached value every N
milliseconds (configurable), e.g. every 500 ms
BENEFIT:
For example, in TCPConnection, the timestamp is updated whenever we send or receive a
message from the peer. The timestamp is used to expire and close a connection (if
configured), and can be updated 100'000 times a second. If the time service provided
the current time in ms every 500ms, then {{System.currentTimeMillis()}} would only be
called 2 times during a second instead of 100'000 times !
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira