Skip to content

Commit

Permalink
8322142: JFR: Periodic tasks aren't orphaned between recordings
Browse files Browse the repository at this point in the history
Backport-of: 1551928502c8ed96350e7b4f1316ea35587407fe
  • Loading branch information
antonha authored and jerboaa committed Jan 26, 2024
1 parent bf7c218 commit a9498e5
Showing 1 changed file with 3 additions and 7 deletions.
Expand Up @@ -63,11 +63,7 @@ private void groupTasksIntoBatches(List<PeriodicTask> tasks) {
}
for (PeriodicTask task : activeSortedTasks(tasks)) {
if (task.isSchedulable()) {
Batch batch = task.getBatch();
// If new task, or period has changed, find new batch
if (batch == null) {
batch = findBatch(task.getPeriod());
}
Batch batch = findBatch(task.getPeriod(), task.getBatch());
batch.add(task);
}
}
Expand All @@ -89,7 +85,7 @@ private List<PeriodicTask> activeSortedTasks(List<PeriodicTask> unsorted) {
return tasks;
}

private Batch findBatch(long period) {
private Batch findBatch(long period, Batch oldBatch) {
// All events with a period less than 1000 ms
// get their own unique batch. The rationale for
// this is to avoid a scenario where a user (mistakenly) specifies
Expand All @@ -102,7 +98,7 @@ private Batch findBatch(long period) {
return batch;
}
}
Batch batch = new Batch(period);
Batch batch = oldBatch != null ? oldBatch : new Batch(period);
batches.add(batch);
return batch;
}
Expand Down

1 comment on commit a9498e5

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.