Skip to content

Commit ce7407a

Browse files
authored
fix thread safety (#1434)
1 parent fe5ad58 commit ce7407a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

common-tools/clas-utils/src/main/java/org/jlab/utils/benchmark/BenchmarkTimer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.jlab.utils.benchmark;
22

33
import java.util.ArrayList;
4-
import java.util.HashMap;
4+
import java.util.concurrent.ConcurrentHashMap;
55
import java.util.concurrent.atomic.AtomicInteger;
66
import java.util.concurrent.atomic.AtomicLong;
77

@@ -12,8 +12,8 @@
1212
public class BenchmarkTimer {
1313

1414
public static class BenchmarkMultiTimer extends BenchmarkTimer {
15-
HashMap<Integer,Long> timeAtResume = new HashMap<>();
16-
HashMap<Integer,Boolean> isPaused = new HashMap<>();
15+
ConcurrentHashMap<Integer,Long> timeAtResume = new ConcurrentHashMap<>();
16+
ConcurrentHashMap<Integer,Boolean> isPaused = new ConcurrentHashMap<>();
1717
public BenchmarkMultiTimer(String name) { super(name); }
1818
public void resume(int thread) {
1919
if (!isPaused.containsKey(thread) || isPaused.get(thread)) {

0 commit comments

Comments
 (0)