Skip to content

Commit

Permalink
debug with frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
blackstar-baba committed Aug 17, 2020
1 parent f4dd083 commit b29ee4c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

public interface IPortService {

public int getRandomPort() throws PortException;
int getRandomPort() throws PortException;

public boolean usePort(int port) ;
boolean usePort(int port) ;

void releasePort(int port);

}
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ public Container getContainer(ContainerInfo containerInfo) {

@Override
public void remove(ContainerInfo containerInfo) {
List<String> ports = containerInfo.getPorts();
for (String portStr : ports) {
portService.releasePort(Integer.parseInt(portStr.split(":")[0]));
}
removeById(containerInfo.getId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,10 @@ public boolean usePort(int port) {

}

@Override
public void releasePort(int port) {
synchronized (lock){
canUsePorts.add(port);
}
}
}

0 comments on commit b29ee4c

Please sign in to comment.