Class FilePoolManager

java.lang.Object
net.simplace.sim.io.FilePoolManager

public class FilePoolManager extends Object
Static registry of the opened files per session, so that a file used by several adapters is opened only once and its data can be shared (see getFile(FileData)).
Author:
Andreas Enders
  • Constructor Details

    • FilePoolManager

      public FilePoolManager()
  • Method Details

    • getFile

      public static FileData getFile(FileData aFileData)
      Looks for an already registered file equal to the given one (same file and session).

      Note: the search only runs if keysSize() is greater than 1, which (because of a bug in MultiHashMap.keysSize()) counts the registered files, not the sessions; with a single registered file nothing is found.

      Parameters:
      aFileData - the file to look for
      Returns:
      the registered file, or null if none was found
    • remove

      public static void remove(FileData aFileData)
      Removes a file from the registry of its session.
      Parameters:
      aFileData - the file
    • add

      public static void add(FWSimSession aSession, FileData aFileData)
      Registers a file for a session.
      Parameters:
      aSession - the session
      aFileData - the file
    • finalize

      public static void finalize(FWSimSession aSession)
      Removes all files of a session from the registry. The files are not closed here; they are closed by the file pools of their interfaces when the adapters are finalized.
      Parameters:
      aSession - the session