Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
Public Member Functions | Protected Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
org.sleuthkit.autopsy.datamodel.utils.AbstractNodePropertySheetTask< T extends AbstractNode > Class Template Referenceabstract

Inherits Runnable.

Public Member Functions

final void run ()
 
final Future<?> submit ()
 

Protected Member Functions

 AbstractNodePropertySheetTask (T node, PropertyChangeListener listener)
 
abstract PropertyChangeEvent computePropertyValue (T node) throws Exception
 

Static Private Member Functions

static Future<?> submitTask (AbstractNodePropertySheetTask<?> task)
 

Private Attributes

final WeakReference< PropertyChangeListener > weakListenerRef
 
final WeakReference< T > weakNodeRef
 

Static Private Attributes

static final ExecutorService executor = Executors.newFixedThreadPool(THREAD_POOL_SIZE, new ThreadFactoryBuilder().setNameFormat("node-background-task-%d").build())
 
static final Logger LOGGER = Logger.getLogger(AbstractContentNode.class.getName())
 
static final Integer THREAD_POOL_SIZE = 10
 

Detailed Description

An abstract base class for background tasks needed to compute values for the property sheet of an AbstractNode.

The results of the computation are returned by firing a PropertyChangeEvent and the run method has an exception firewall with logging. These features relieve the AbstractNode from having to create a thread to block on the get() method of the task Future.

Only weak references to the AbstractNode and its PropertyChangeListener are held prior to task execution so that a queued task does not interfere with garbage collection if the node has been destroyed by the NetBeans framework.

A thread pool with descriptively named threads (node-background-task-N) is provided for executing instances of the tasks.

Definition at line 49 of file AbstractNodePropertySheetTask.java.

Constructor & Destructor Documentation

org.sleuthkit.autopsy.datamodel.utils.AbstractNodePropertySheetTask< T extends AbstractNode >.AbstractNodePropertySheetTask ( node,
PropertyChangeListener  listener 
)
protected

Constructs an abstract base class for background tasks needed to compute values for the property sheet of an AbstractNode.

The results of the computation are returned by firing a PropertyChangeEvent and the run method has an exception firewall with logging. These features relieve the AbstractNode from having to create a thread to block on the get() method of the task Future.

Only weak references to the AbstractNode and its PropertyChangeListener are held prior to task execution so that a queued task does not interfere with garbage collection if the node has been destroyed by the NetBeans framework.

A thread pool with descriptively named threads (node-background-task-N) is provided for executing instances of the tasks.

Parameters
nodeThe node.
listenerA property change listener for the node.

Definition at line 91 of file AbstractNodePropertySheetTask.java.

Member Function Documentation

abstract PropertyChangeEvent org.sleuthkit.autopsy.datamodel.utils.AbstractNodePropertySheetTask< T extends AbstractNode >.computePropertyValue ( node) throws Exception
abstractprotected

Computes the values for the property sheet of an AbstractNode. The results of the computation are returned as a PropertyChangeEvent which is fired to the PropertyChangeEventListener of the node.

IMPORTANT: Implementations of this method should check for cancellation by calling Thread.currentThread().isInterrupted() at appropriate intervals.

Parameters
nodeThe AbstractNode.
Returns
The result of the computation as a PropertyChangeEvent, may be null.

Referenced by org.sleuthkit.autopsy.datamodel.utils.AbstractNodePropertySheetTask< AbstractNode >.run().

final void org.sleuthkit.autopsy.datamodel.utils.AbstractNodePropertySheetTask< T extends AbstractNode >.run ( )

Definition at line 122 of file AbstractNodePropertySheetTask.java.

final Future<?> org.sleuthkit.autopsy.datamodel.utils.AbstractNodePropertySheetTask< T extends AbstractNode >.submit ( )

Submits this task to the ExecutorService for the thread pool.

Returns
The task's Future from the ExecutorService.

Definition at line 117 of file AbstractNodePropertySheetTask.java.

static Future<?> org.sleuthkit.autopsy.datamodel.utils.AbstractNodePropertySheetTask< T extends AbstractNode >.submitTask ( AbstractNodePropertySheetTask<?>  task)
staticprivate

Submits a task to compute values for the property sheet of an AbstractNode to a thread pool dedicated to such tasks with descriptively named threads (node-background-task-N).

Parameters
taskThe task.
Returns
The Future of the task, may be used for task cancellation by calling Future.cancel(true).

Definition at line 67 of file AbstractNodePropertySheetTask.java.

Referenced by org.sleuthkit.autopsy.datamodel.utils.AbstractNodePropertySheetTask< AbstractNode >.submit().

Member Data Documentation

final ExecutorService org.sleuthkit.autopsy.datamodel.utils.AbstractNodePropertySheetTask< T extends AbstractNode >.executor = Executors.newFixedThreadPool(THREAD_POOL_SIZE, new ThreadFactoryBuilder().setNameFormat("node-background-task-%d").build())
staticprivate

Definition at line 53 of file AbstractNodePropertySheetTask.java.

final Logger org.sleuthkit.autopsy.datamodel.utils.AbstractNodePropertySheetTask< T extends AbstractNode >.LOGGER = Logger.getLogger(AbstractContentNode.class.getName())
staticprivate

Definition at line 51 of file AbstractNodePropertySheetTask.java.

final Integer org.sleuthkit.autopsy.datamodel.utils.AbstractNodePropertySheetTask< T extends AbstractNode >.THREAD_POOL_SIZE = 10
staticprivate

Definition at line 52 of file AbstractNodePropertySheetTask.java.

final WeakReference<PropertyChangeListener> org.sleuthkit.autopsy.datamodel.utils.AbstractNodePropertySheetTask< T extends AbstractNode >.weakListenerRef
private

Definition at line 55 of file AbstractNodePropertySheetTask.java.

final WeakReference<T> org.sleuthkit.autopsy.datamodel.utils.AbstractNodePropertySheetTask< T extends AbstractNode >.weakNodeRef
private

Definition at line 54 of file AbstractNodePropertySheetTask.java.


The documentation for this class was generated from the following file:

Copyright © 2012-2022 Basis Technology. Generated on: Wed Oct 5 2022
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.