}\r
LOG.debug("Successfully populated available ports list.");\r
}\r
-\r
- public String reserveServerPort() throws ServerPortAllocationException {\r
+ \r
+ public synchronized String reserveServerPort() throws ServerPortAllocationException {\r
\r
if (availablePorts.isEmpty()) {\r
LOG.debug(\r
LOG.debug("Trying to reserve port : {}", port);\r
if (isServerPortInUse(port)) {\r
LOG.debug("Port {} is already in use.", port);\r
+ availablePorts.poll();\r
return reserveServerPort(); // retry if current port is not available\r
}\r
\r