Skip to content

Commit

Permalink
7903490: JMH: The interrupt to time-outing benchmark can be delivered…
Browse files Browse the repository at this point in the history
… to worker data barrier
  • Loading branch information
shipilev authored Jun 9, 2023
1 parent bf8db38 commit 9a97557
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -433,18 +433,19 @@ public IterationResult runIteration(BenchmarkParams benchmarkParams, IterationPa
}


private WorkerData getWorkerData(Thread worker) {
private WorkerData getWorkerData(Thread worker) throws Exception {
// See if there is a good worker data for us already, use it.
WorkerData wd = workerData.remove(worker);

// Wait for all threads to roll to this synchronization point.
// If there is any thread without assignment, the barrier action
// would dump the unused worker data for claiming.
try {
workerDataBarrier.await();
} catch (InterruptedException | BrokenBarrierException e) {
throw new IllegalStateException("Worker data barrier error ", e);
}
//
// In face of interruptions, the barrier can either throw the interrupted
// exception if this thread caughts it and breaks the barrier,
// or broken barrier exception if other threads were waiting on this
// barrier. Bubble up both exceptions, and let the caller handle.
workerDataBarrier.await();

if (wd == null) {
// Odd mode, no worker task recorded for the thread. Pull the worker data
Expand Down

0 comments on commit 9a97557

Please sign in to comment.