Object BrowserFiles

    • Constructor Detail

    • Method Detail

      • computeTestContextDir

        @Synchronized() final Path computeTestContextDir(Fingerprint fingerprint, Integer maxAgents)

        Compute the next sequential test context directory. A typical context directory is like: /tmp/pulsar-vincent/context/group/test/cx.1

        Parameters:
        fingerprint - The fingerprint
        maxAgents - The maximum number of available agents, every agent has its own context directory
        Returns:

        The next sequential context directory

      • computeNextSequentialContextDir

        @Synchronized() final Path computeNextSequentialContextDir(String group, Fingerprint fingerprint, Integer maxAgents)

        Compute the next sequential context directory. A typical context directory is like: /tmp/pulsar-vincent/context/group/default/cx.1

        Parameters:
        group - The group name, default is "default"
        fingerprint - The fingerprint
        maxAgents - The maximum number of available agents, every agent has its own context directory
        Returns:

        The next sequential context directory

      • cleanUpContextTmpDir

         final Unit cleanUpContextTmpDir(Duration expiry)

        Clean up the context directories that are expired.

        Parameters:
        expiry - The expiry duration
      • cleanUpContextDir

         final Unit cleanUpContextDir(Path contextDir, Duration expiry)

        Clear the browser's user data dir inside the given context path.

        Only clean the context directory which starts with "cx."

        Parameters:
        contextDir - The path to the context directory
        expiry - The expiry duration
      • deleteTemporaryUserDataDirWithLock

        @Synchronized() final Unit deleteTemporaryUserDataDirWithLock(String group, Path userDataDir, Duration expiry)

        Deletes the temporary user data directory if specific conditions are met.

        This function ensures that the directory is only deleted if:

        • The lock file is locked, no other thread is accessing it.

        • The directory is not already in the cleaned set.

        • The directory is within the temporary context directory.

        • The directory has expired based on its modification time.

        • The directory has a sibling file named "PID_FILE_NAME".

        Parameters:
        group - The group name, default is "default"
        userDataDir - The path to the user data directory that needs to be checked and potentially deleted.
        expiry - The duration after which the directory is considered expired and eligible for deletion.
      • getContextGroupDirLockFile

         final Path getContextGroupDirLockFile(String group)

        Get the lock file of the context group. The lock file is used to ensure that only one process can access the context group directory at a time.

        A typical lock file is like: /tmp/pulsar-vincent/context/group/default/context.lock The lock file is created in the context group directory.

        Parameters:
        group - The context group name.
        Returns:

        The lock file of the context group.

      • getTempContextGroupDirLockFile

         final Path getTempContextGroupDirLockFile(String group)

        Get the lock file of the context group. The lock file is used to ensure that only one process can access the context group directory at a time.

        A typical lock file is like: /tmp/pulsar-vincent/context/tmp/groups/default/context.lock The lock file is created in the context group directory.

        Parameters:
        group - The context group name.
        Returns:

        The lock file of the context group.

      • getContextGroupLockFileFromUserDataDir

         final Path getContextGroupLockFileFromUserDataDir(Path userDataDir)

        Get the lock file of the context group from the user data directory. The lock file is used to ensure that only one process can access the context group directory at a time.

        A typical lock file is like: /tmp/pulsar-vincent/context/group/default/context.lock The lock file is created in the context group directory.

        Parameters:
        userDataDir - The user data directory of the context group.
        Returns:

        The lock file of the context group.