Package org.jgroups.util
Class PortsManager
java.lang.Object
org.jgroups.util.PortsManager
Maintains a list of ports used on this host, associated with time stamps. The ports are persistet into the
temp file system.
- Version:
- $Id: PortsManager.java,v 1.4.2.3 2009/01/05 07:41:00 belaban Exp $
- Author:
- Bela Ban
-
Constructor Summary
ConstructorsConstructorDescriptionPortsManager
(long expiry_time) PortsManager
(long expiry_time, String ports_file) PortsManager
(long expiry_time, String filename, String temp_dir) PortsManager
(String ports_file) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Deletes the underlying file.long
int
getNextAvailablePort
(int start_port) Loads the file, weeds out expired ports, returns the next available port and saves the new port in the filevoid
removePort
(int port) Loads the file, removes the port (if existent) and closes the file againvoid
setExpiryTime
(long expiry_time) void
updatePort
(int port) Updates the timestamp for the given port
-
Constructor Details
-
PortsManager
public PortsManager() -
PortsManager
public PortsManager(long expiry_time) -
PortsManager
-
PortsManager
-
PortsManager
-
-
Method Details
-
getExpiryTime
public long getExpiryTime() -
setExpiryTime
public void setExpiryTime(long expiry_time) -
getNextAvailablePort
public int getNextAvailablePort(int start_port) Loads the file, weeds out expired ports, returns the next available port and saves the new port in the file -
removePort
public void removePort(int port) Loads the file, removes the port (if existent) and closes the file again -
updatePort
public void updatePort(int port) Updates the timestamp for the given port- Parameters:
port
-
-
deleteFile
public void deleteFile()Deletes the underlying file. Used for unit testing, not recommended for regular use !
-