Class PortFileManager

java.lang.Object
org.pentaho.platform.settings.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 Details

    • 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
    • writeUsedPortFile

      public void writeUsedPortFile(String filePath) throws FileNotFoundException, IOException
      Writes a port list delimited by comma into a specified file
      Parameters:
      filePath - Path for the file to be written
      Throws:
      FileNotFoundException
      IOException
    • clear

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