[jboss-jira] [JBoss JIRA] (JGRP-1763) TimeService
Bela Ban (JIRA)
issues at jboss.org
Tue Dec 31 05:43:32 EST 2013
[ https://issues.jboss.org/browse/JGRP-1763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12933296#comment-12933296 ]
Bela Ban commented on JGRP-1763:
--------------------------------
Investigate where else this could be used. E.g. {{UNICAST3$Entry.update()}}
> 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
More information about the jboss-jira
mailing list