JDK-7127792 : Add the ability to change an existing PeriodicTask's execution interval
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: hs25
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-01-06
  • Updated: 2015-03-03
  • Resolved: 2012-11-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 Other
7u40Fixed 8Fixed hs24Fixed
Related Reports
Relates :  
Java Flight Recorder and possibly other Hotspot sub-systems, must be able to change
a PeriodicTask's execution interval.

On 1/9/12 2:48 AM, David Holmes wrote: > On 7/01/2012 1:59 PM, Paul Hohensee wrote: >> Take a look at the repo at /java/east/u1/phh/jfr7/hotspot/. > > The task code is not written to be thread-safe. If someone has > analysed this to ensure that everything works as they expect then they > should at least update the comments to reflect that - and make it > clear that absence of synchronization and lack of memory visibility > will not cause problems. > > And I will insist that ping be renamed! unpark() captures the > semantics exactly. It can be an instance method instead of static and > just do the actual unpark(). It can be used by the stop() code as well.

I was referring to the thread-safety of the general handling of periodic tasks. There is/was code that relies on the fact that the task queue can't arbitrarily change after VM startup.

David, when talking about thread-safety. Are you talking about the code inside the tasks or the general handling of PeriodicTasks? I'm considering modifying the PeriodicTask and handling in the WatcherThread by adding a lock that would control adding/removing of tasks as well as changing the time. An alternative would be to try to do it with CAS, but since we don't expect any contention here it seems like overengineering to me.