Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[H2-1984] Add a TcpServer.listPorts() static method #1989

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions h2/src/main/org/h2/server/TcpServer.java
Expand Up @@ -421,6 +421,19 @@ boolean getIfExists() {
return ifExists;
}

public static Set<Integer> listPorts() {
Set<Integer> ports = new HashSet<>();

if(SERVERS.isEmpty()) {
return ports;
}

for(Integer port : SERVERS.keySet()) {
ports.add(port);
}
return ports;
}

/**
* Stop the TCP server with the given URL.
*
Expand Down