Class PortsManager

java.lang.Object
org.jgroups.util.PortsManager

public class PortsManager extends Object
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 Details

    • PortsManager

      public PortsManager()
    • PortsManager

      public PortsManager(long expiry_time)
    • PortsManager

      public PortsManager(String ports_file)
    • PortsManager

      public PortsManager(long expiry_time, String ports_file)
    • PortsManager

      public PortsManager(long expiry_time, String filename, String temp_dir)
  • 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 !