Skip to content

Commit

Permalink
only check port when the application is starting server
Browse files Browse the repository at this point in the history
  • Loading branch information
ZihengSun committed Jul 6, 2024
1 parent 5d24c1d commit a2f5511
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/com/gw/GeoweaverApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ public class GeoweaverApplication {

public static void main(String[] args) {

if (BaseTool.isPortInUse("localhost", BaseTool.get_current_port())) {
System.out.println("Port " + BaseTool.get_current_port() + " is already used. Cannot start Geoweaver.");
System.out.println("Could set the environment variable GEOWEAVER_PORT to another port and try again.");
System.exit(1);
}

// if we have a command line argument, we assume it is a command
if (args.length > 0) {

Expand All @@ -63,6 +57,12 @@ public static void main(String[] args) {

} else {

if (BaseTool.isPortInUse("localhost", BaseTool.get_current_port())) {
System.out.println("Port " + BaseTool.get_current_port() + " is already used. Cannot start Geoweaver.");
System.out.println("Could set the environment variable GEOWEAVER_PORT to another port and try again.");
System.exit(1);
}

ApplicationContext applicationContext =
new SpringApplicationBuilder(GeoweaverApplication.class)
.bannerMode(Banner.Mode.OFF)
Expand Down

0 comments on commit a2f5511

Please sign in to comment.