Package ghidra.formats.gfilesystem
Class FileSystemRefManager
java.lang.Object
ghidra.formats.gfilesystem.FileSystemRefManager
A threadsafe helper class that manages creating and releasing
FileSystemRef instances
and broadcasting events to FileSystemEventListener listeners.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(FileSystemEventListener listener) booleancanClose(FileSystemRef callersRef) Returns true if the onlyFileSystemRefpinning this filesystem is the caller's ref.create()Creates a newFileSystemRefthat points at the owningfilesystem.voidfinalize()longvoidonClose()Called from theCloseable.close()before any destructive changes have been made to gracefully shutdown the ref manager.voidrelease(FileSystemRef ref) Releases an existingFileSystemRefand broadcastsFileSystemEventListener.onFilesystemRefChange(GFileSystem, FileSystemRefManager)to listeners.voidremoveListener(FileSystemEventListener listener) Removes a previously addedlistener.
-
Constructor Details
-
FileSystemRefManager
Creates a newFileSystemRefManagerpointing at the specifiedGFileSystem.- Parameters:
fs-GFileSystemto manage.
-
-
Method Details
-
addListener
- Parameters:
listener-FileSystemEventListenerto receive callbacks, weakly refd and automagically removed if a reference isn't held to the listener somewhere else.
-
removeListener
Removes a previously addedlistener.- Parameters:
listener-FileSystemEventListenerto remove.
-
create
Creates a newFileSystemRefthat points at the owningfilesystem.- Returns:
- new
FileSystemRefpointing at the filesystem, never null.
-
release
Releases an existingFileSystemRefand broadcastsFileSystemEventListener.onFilesystemRefChange(GFileSystem, FileSystemRefManager)to listeners.- Parameters:
ref- theFileSystemRefto release.
-
canClose
Returns true if the onlyFileSystemRefpinning this filesystem is the caller's ref.- Parameters:
callersRef-FileSystemRefto test- Returns:
- boolean true if the tested
FileSystemRefis the only ref pinning the filesystem.
-
onClose
public void onClose()Called from theCloseable.close()before any destructive changes have been made to gracefully shutdown the ref manager.Broadcasts
FileSystemEventListener.onFilesystemClose(GFileSystem). -
finalize
public void finalize() -
getLastUsedTimestamp
public long getLastUsedTimestamp()
-