Class PortFileManager


  • public class PortFileManager
    extends Object
    PortFileManager is a singleton that saves the ports in use and creates a file with a ports list when requested.
    Author:
    Joao L. M. Pereira
    • Method Detail

      • getInstance

        public static PortFileManager getInstance()
        Returns the PortFileManager instance, if it does not exists, creates a new one
        Returns:
        the PortFileManager instance, it is a singleton
      • addPort

        public boolean addPort​(Integer port)
        Add a new used port
        Parameters:
        port - a port being used
        Returns:
        true, if the port did not exist before
      • removePort

        public boolean removePort​(Integer port)
        Removes a used port
        Parameters:
        port - a port that was used, not anymore
        Returns:
        true, if the port exist before
      • clear

        public void clear()
        Used for testing, simulates a new JVM