Class OldDirectoryBasedCleanupRegistry
- java.lang.Object
-
- jetbrains.buildServer.agent.impl.directories.OldDirectoryBasedCleanupRegistry
-
public class OldDirectoryBasedCleanupRegistry extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
OldDirectoryBasedCleanupRegistry.CleanupListener
-
Constructor Summary
Constructors Constructor Description OldDirectoryBasedCleanupRegistry(FileRemoverFactory fileRemoverFactory, AgentIdleTasks agentIdleTasks)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description File
enableCleanupUsingOldDirectory(File dir, OldDirectoryBasedCleanupRegistry.CleanupListener cleanupListener)
Enables background cleanup for directory with nameAgentConstants.OLD_DIR_NAME
which will be created under the specified directory.Map<File,Runnable>
getCleanerTasks(InterruptState interruptable)
Collection<File>
getCleanupFiles()
File
getCleanupFolder(File file)
-
-
-
Constructor Detail
-
OldDirectoryBasedCleanupRegistry
public OldDirectoryBasedCleanupRegistry(@NotNull FileRemoverFactory fileRemoverFactory, @NotNull AgentIdleTasks agentIdleTasks)
-
-
Method Detail
-
getCleanupFiles
@NotNull public Collection<File> getCleanupFiles()
-
getCleanerTasks
@NotNull public Map<File,Runnable> getCleanerTasks(@NotNull InterruptState interruptable)
-
enableCleanupUsingOldDirectory
@Nullable public File enableCleanupUsingOldDirectory(@NotNull File dir, @Nullable OldDirectoryBasedCleanupRegistry.CleanupListener cleanupListener)
Enables background cleanup for directory with name
AgentConstants.OLD_DIR_NAME
which will be created under the specified directory. Path toAgentConstants.OLD_DIR_NAME
will be returned as a result.Once a cleanup is enabled for a directory, behavior of
DirectoryCleaner.delete(File, DirectoryCleanerCallback)
changes. If a file under registered directory is removed using this method, then it will be placed into the correspondingAgentConstants.OLD_DIR_NAME
directory.Later, when agent becomes idle, all
AgentConstants.OLD_DIR_NAME
will be cleaned up.- Parameters:
dir
- directory for which to enable background cleanup viaAgentConstants.OLD_DIR_NAME
directorycleanupListener
- can be used to prepare cleanup directory by moving additional files which should be cleaned there- Returns:
- created folder with name
AgentConstants.OLD_DIR_NAME
-
-