Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

Commit b3e3e4d

Browse files
feat: add port as a parameter for the bigtable emulator
1 parent 9f2dfc0 commit b3e3e4d

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,13 @@ public synchronized boolean isRunning() {
9393
}
9494

9595
/** Starts the emulator process and waits for it to be ready. */
96-
public synchronized void start() throws IOException, TimeoutException, InterruptedException {
96+
public synchronized void start(int port) throws IOException, TimeoutException, InterruptedException {
9797
if (!isStopped) {
9898
throw new IllegalStateException("Emulator is already started");
9999
}
100-
this.port = getAvailablePort();
101-
100+
101+
this.port = port;
102+
102103
// Try to align the localhost address across java & golang emulator
103104
// This should fix issues on systems that default to ipv4 but the jvm is started with
104105
// -Djava.net.preferIPv6Addresses=true
@@ -143,6 +144,11 @@ public synchronized void start() throws IOException, TimeoutException, Interrupt
143144
waitForPort(port);
144145
}
145146

147+
/** Starts the emulator process and waits for it to be ready. */
148+
public synchronized void start() throws IOException, TimeoutException, InterruptedException {
149+
start(getAvailablePort());
150+
}
151+
146152
/** Stops the emulator process. */
147153
public synchronized void stop() {
148154
if (isStopped) {

0 commit comments

Comments
 (0)