Skip to content

Commit 01720b6

Browse files
authored
test: fix race in emulator controller (#2756)
* test: fix race in emulator controller * fix
1 parent f4398bb commit 01720b6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

google-cloud-bigtable-emulator-core/src/main/java/com/google/cloud/bigtable/emulator/core/EmulatorController.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,12 @@ public synchronized void start(int port)
134134
shutdownHook =
135135
new Thread(
136136
() -> {
137-
if (!isStopped) {
138-
isStopped = true;
139-
process.destroy();
137+
synchronized (EmulatorController.this) {
138+
if (!isStopped) {
139+
isStopped = true;
140+
}
140141
}
142+
process.destroy();
141143
});
142144

143145
Runtime.getRuntime().addShutdownHook(shutdownHook);

0 commit comments

Comments
 (0)