Skip to content

Commit 0a9edb6

Browse files
author
Dave Bassan
committed
make StopWatch thread safe.
1 parent 2c2b508 commit 0a9edb6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/src/main/java/cucumber/runtime/StopWatch.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ public interface StopWatch {
99
long stop();
1010

1111
StopWatch SYSTEM = new StopWatch() {
12-
public Long start;
12+
public ThreadLocal<Long> start = new ThreadLocal<Long>();
1313

1414
@Override
1515
public void start() {
16-
start = System.nanoTime();
16+
start.set(System.nanoTime());
1717
}
1818

1919
@Override
2020
public long stop() {
21-
Long duration = System.nanoTime() - start;
22-
start = null;
21+
Long duration = System.nanoTime() - start.get();
22+
start.set(null);
2323
return duration;
2424
}
2525
};

0 commit comments

Comments
 (0)