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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(FileSystemEventListener listener) boolean
canClose
(FileSystemRef callersRef) Returns true if the onlyFileSystemRef
pinning this filesystem is the caller's ref.create()
Creates a newFileSystemRef
that points at the owningfilesystem
.void
finalize()
long
void
onClose()
Called from theCloseable.close()
before any destructive changes have been made to gracefully shutdown the ref manager.void
release
(FileSystemRef ref) Releases an existingFileSystemRef
and broadcastsFileSystemEventListener.onFilesystemRefChange(GFileSystem, FileSystemRefManager)
to listeners.void
removeListener
(FileSystemEventListener listener) Removes a previously addedlistener
.
-
Constructor Details
-
FileSystemRefManager
Creates a newFileSystemRefManager
pointing at the specifiedGFileSystem
.- Parameters:
fs
-GFileSystem
to manage.
-
-
Method Details
-
addListener
- Parameters:
listener
-FileSystemEventListener
to 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
-FileSystemEventListener
to remove.
-
create
Creates a newFileSystemRef
that points at the owningfilesystem
.- Returns:
- new
FileSystemRef
pointing at the filesystem, never null.
-
release
Releases an existingFileSystemRef
and broadcastsFileSystemEventListener.onFilesystemRefChange(GFileSystem, FileSystemRefManager)
to listeners.- Parameters:
ref
- theFileSystemRef
to release.
-
canClose
Returns true if the onlyFileSystemRef
pinning this filesystem is the caller's ref.- Parameters:
callersRef
-FileSystemRef
to test- Returns:
- boolean true if the tested
FileSystemRef
is 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()
-