APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.jfr.internal.periodic

public final Class PeriodicEvents

extends Object
Class Inheritance
Imports
java.util.ArrayList, .List, java.util.concurrent.atomic.AtomicLong, jdk.internal.event.Event, jdk.jfr.internal.JVM, .LogLevel, .LogTag, .Logger, .PlatformEventType

Class that runs and schedules tasks for periodic events.

Events can run at the beginning of a chunk rotation, at the end of a chunk rotation or at a periodic interval.

Events with the same period runs in the same order as users added them. Temporarily disabling events don't impact the order of execution.

A best effort is made to run events with different periods at the same time. For example, an event that runs every two seconds executes half of the time with the events that run every second.

Field Summary

Modifier and TypeField and Description
private static final BatchManager
private static final FlushTask
private static long
private static final AtomicLong
private static final TaskRepository

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
addJavaEvent(Class<? extends Event> eventClass, Runnable runnable)

public static void
public static void
doChunkBegin(boolean startRecording)

public static void
public static long
public static boolean
public static void
setChanged()

Marks that a change has happened to a periodic event.

public static void
setFlushInterval(long millis)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

batchManagerback to summary
private static final BatchManager batchManager
flushTaskback to summary
private static final FlushTask flushTask
lastTimeMillisback to summary
private static long lastTimeMillis
settingsIterationback to summary
private static final AtomicLong settingsIteration
taskRepositoryback to summary
private static final TaskRepository taskRepository

Constructor Detail

PeriodicEventsback to summary
public PeriodicEvents()

Method Detail

addJavaEventback to summary
public static void addJavaEvent(Class<? extends Event> eventClass, Runnable runnable)
addJVMEventback to summary
public static void addJVMEvent(PlatformEventType eventType)
doChunkBeginback to summary
public static void doChunkBegin(boolean startRecording)
doChunkEndback to summary
public static void doChunkEnd()
doPeriodicback to summary
public static long doPeriodic()
removeEventback to summary
public static boolean removeEvent(Runnable runnable)
setChangedback to summary
public static void setChanged()

Marks that a change has happened to a periodic event.

This method should be invoked if a periodic event has:

  • been added
  • been removed
  • been enabled
  • been disabled
  • changed period

The periodic task thread will poll the changed state at least once every second to see if a change has occurred. if that's the case, it will refresh periodic tasks that need to be run.

setFlushIntervalback to summary
public static void setFlushInterval(long millis)