Merge pull request #718 from rcordovano/one_pipeline_per_thread

One pipeline per thread
This commit is contained in:
Richard Cordovano 2014-05-13 15:38:48 -04:00
commit fba70c24f8
6 changed files with 93 additions and 95 deletions

View File

@ -25,6 +25,22 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="keepCurrentViewerRB" min="-2" max="-2" attributes="0"/>
<Component id="useBestViewerRB" min="-2" max="-2" attributes="0"/>
<Component id="dataSourcesHideKnownCB" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="viewsHideKnownCB" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="numberOfFileIngestThreadsComboBox" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel5" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
@ -35,27 +51,11 @@
<Component id="useGMTTimeRB" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="keepCurrentViewerRB" min="-2" max="-2" attributes="0"/>
<Component id="useBestViewerRB" min="-2" max="-2" attributes="0"/>
<Component id="dataSourcesHideKnownCB" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="viewsHideKnownCB" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="numberOfFileIngestThreadsComboBox" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
@ -83,7 +83,10 @@
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="numberOfFileIngestThreadsComboBox" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="numberOfFileIngestThreadsComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
@ -102,9 +105,6 @@
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyOptionsPanel.useBestViewerRB.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="useBestViewerRBActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="keepCurrentViewerRB">
<Properties>
@ -118,9 +118,6 @@
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyOptionsPanel.keepCurrentViewerRB.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="keepCurrentViewerRBActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
@ -156,9 +153,6 @@
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyOptionsPanel.useGMTTimeRB.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="useGMTTimeRBActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
@ -198,5 +192,15 @@
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;Integer&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/corecomponents/warning16.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyOptionsPanel.jLabel5.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -77,6 +77,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
viewsHideKnownCB = new javax.swing.JCheckBox();
jLabel4 = new javax.swing.JLabel();
numberOfFileIngestThreadsComboBox = new javax.swing.JComboBox<Integer>();
jLabel5 = new javax.swing.JLabel();
buttonGroup1.add(useBestViewerRB);
useBestViewerRB.setSelected(true);
@ -106,6 +107,9 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.jLabel4.text")); // NOI18N
jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/warning16.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.jLabel5.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@ -113,6 +117,19 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(keepCurrentViewerRB)
.addComponent(useBestViewerRB)
.addComponent(dataSourcesHideKnownCB)
.addComponent(viewsHideKnownCB)
.addGroup(layout.createSequentialGroup()
.addComponent(numberOfFileIngestThreadsComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
@ -120,22 +137,10 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(useLocalTimeRB)
.addComponent(useGMTTimeRB))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(useGMTTimeRB)))
.addComponent(jLabel1)
.addComponent(jLabel3)
.addComponent(jLabel4)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(keepCurrentViewerRB)
.addComponent(useBestViewerRB)
.addComponent(dataSourcesHideKnownCB)
.addComponent(viewsHideKnownCB)
.addComponent(numberOfFileIngestThreadsComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(0, 0, Short.MAX_VALUE))))
.addComponent(jLabel4))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -160,7 +165,9 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(numberOfFileIngestThreadsComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(numberOfFileIngestThreadsComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5)))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
@ -171,6 +178,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JRadioButton keepCurrentViewerRB;
private javax.swing.JComboBox<Integer> numberOfFileIngestThreadsComboBox;
private javax.swing.JRadioButton useBestViewerRB;

View File

@ -139,3 +139,4 @@ AutopsyOptionsPanel.keepCurrentViewerRB.toolTipText=For example, stay in Hex vie
AutopsyOptionsPanel.keepCurrentViewerRB.text=Stay on the same file viewer
AutopsyOptionsPanel.jLabel1.text=When selecting a file:
AutopsyOptionsPanel.jLabel2.text=When displaying times:
AutopsyOptionsPanel.jLabel5.text=Restart required to take effect

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

View File

@ -73,8 +73,8 @@ final class IngestJob {
IngestJobContext context = new IngestJobContext(this);
List<IngestModuleError> errors = new ArrayList<>();
int maxNumberOfPipelines = IngestManager.getMaxNumberOfDataSourceIngestThreads();
for (int i = 0; i < maxNumberOfPipelines; ++i) {
int numberOfPipelines = IngestManager.getInstance().getNumberOfDataSourceIngestThreads();
for (int i = 0; i < numberOfPipelines; ++i) {
DataSourceIngestPipeline pipeline = new DataSourceIngestPipeline(context, ingestModuleTemplates);
errors.addAll(pipeline.startUp());
dataSourceIngestPipelines.put(pipeline);
@ -84,8 +84,8 @@ final class IngestJob {
}
}
maxNumberOfPipelines = IngestManager.getMaxNumberOfFileIngestThreads();
for (int i = 0; i < maxNumberOfPipelines; ++i) {
numberOfPipelines = IngestManager.getInstance().getNumberOfFileIngestThreads();
for (int i = 0; i < numberOfPipelines; ++i) {
FileIngestPipeline pipeline = new FileIngestPipeline(context, ingestModuleTemplates);
errors.addAll(pipeline.startUp());
fileIngestPipelines.put(pipeline);

View File

@ -46,7 +46,6 @@ import org.sleuthkit.autopsy.core.UserPreferences;
*/
public class IngestManager {
private static final int MAX_NUMBER_OF_DATA_SOURCE_INGEST_THREADS = 1;
private static final int MIN_NUMBER_OF_FILE_INGEST_THREADS = 1;
private static final int MAX_NUMBER_OF_FILE_INGEST_THREADS = 16;
private static final int DEFAULT_NUMBER_OF_FILE_INGEST_THREADS = 2;
@ -65,6 +64,7 @@ public class IngestManager {
private final ConcurrentHashMap<Long, Future<?>> dataSourceIngestThreads = new ConcurrentHashMap<>(); // Maps thread ids to cancellation handles.
private final ConcurrentHashMap<Long, Future<?>> fileIngestThreads = new ConcurrentHashMap<>(); // Maps thread ids to cancellation handles.
private volatile IngestMessageTopComponent ingestMessageBox;
private int numberOfFileIngestThreads;
/**
* Gets the ingest manager.
@ -81,7 +81,7 @@ public class IngestManager {
*/
private IngestManager() {
startDataSourceIngestThread();
int numberOfFileIngestThreads = UserPreferences.numberOfFileIngestThreads();
numberOfFileIngestThreads = UserPreferences.numberOfFileIngestThreads();
if ((numberOfFileIngestThreads < MIN_NUMBER_OF_FILE_INGEST_THREADS) || (numberOfFileIngestThreads > MAX_NUMBER_OF_FILE_INGEST_THREADS)) {
numberOfFileIngestThreads = DEFAULT_NUMBER_OF_FILE_INGEST_THREADS;
UserPreferences.setNumberOfFileIngestThreads(numberOfFileIngestThreads);
@ -89,15 +89,6 @@ public class IngestManager {
for (int i = 0; i < numberOfFileIngestThreads; ++i) {
startFileIngestThread();
}
UserPreferences.addChangeListener(new PreferenceChangeListener() {
@Override
public void preferenceChange(PreferenceChangeEvent evt) {
if (evt.getKey().equals(UserPreferences.NUMBER_OF_FILE_INGEST_THREADS)) {
setNumberOfFileIngestThreads();
}
}
});
}
/**
@ -112,49 +103,19 @@ public class IngestManager {
}
/**
* Gets the maximum number of data source ingest threads the ingest manager
* will use.
* Gets the number of data source ingest threads the ingest manager will
* use.
*/
public static int getMaxNumberOfDataSourceIngestThreads() {
return MAX_NUMBER_OF_DATA_SOURCE_INGEST_THREADS;
public int getNumberOfDataSourceIngestThreads() {
return 1;
}
/**
* Gets the maximum number of file ingest threads the ingest manager will
* use.
*/
public static int getMaxNumberOfFileIngestThreads() {
return MAX_NUMBER_OF_FILE_INGEST_THREADS;
}
/**
* Changes the number of file ingest threads the ingest manager will use to
* no more than MAX_NUMBER_OF_FILE_INGEST_THREADS and no less than
* MIN_NUMBER_OF_FILE_INGEST_THREADS. Out of range requests are converted to
* requests for DEFAULT_NUMBER_OF_FILE_INGEST_THREADS.
*
* @param numberOfThreads The desired number of file ingest threads.
*/
public synchronized static void setNumberOfFileIngestThreads() {
int numberOfThreads = UserPreferences.numberOfFileIngestThreads();
if ((numberOfThreads < MIN_NUMBER_OF_FILE_INGEST_THREADS) || (numberOfThreads > MAX_NUMBER_OF_FILE_INGEST_THREADS)) {
numberOfThreads = DEFAULT_NUMBER_OF_FILE_INGEST_THREADS;
UserPreferences.setNumberOfFileIngestThreads(numberOfThreads);
}
if (instance.fileIngestThreads.size() != numberOfThreads) {
if (instance.fileIngestThreads.size() > numberOfThreads) {
Long[] threadIds = instance.fileIngestThreads.keySet().toArray(new Long[instance.fileIngestThreads.size()]);
int numberOfThreadsToCancel = instance.fileIngestThreads.size() - numberOfThreads;
for (int i = 0; i < numberOfThreadsToCancel; ++i) {
instance.cancelFileIngestThread(threadIds[i]);
}
} else if (instance.fileIngestThreads.size() < numberOfThreads) {
int numberOfThreadsToAdd = numberOfThreads - instance.fileIngestThreads.size();
for (int i = 0; i < numberOfThreadsToAdd; ++i) {
instance.startFileIngestThread();
}
}
}
public int getNumberOfFileIngestThreads() {
return numberOfFileIngestThreads;
}
/**
@ -319,6 +280,30 @@ public class IngestManager {
ingestModuleEventPublisher.removePropertyChangeListener(listener);
}
/**
* Add an ingest job and ingest module event property change listener.
*
* @deprecated Use addIngestJobEventListener() and/or
* addIngestModuleEventListener().
* @param listener The PropertyChangeListener to register.
*/
public static void addPropertyChangeListener(final PropertyChangeListener listener) {
instance.ingestJobEventPublisher.addPropertyChangeListener(listener);
instance.ingestModuleEventPublisher.addPropertyChangeListener(listener);
}
/**
* Remove an ingest job and ingest module event property change listener.
*
* @deprecated Use removeIngestJobEventListener() and/or
* removeIngestModuleEventListener().
* @param listener The PropertyChangeListener to unregister.
*/
public static void removePropertyChangeListener(final PropertyChangeListener listener) {
instance.ingestJobEventPublisher.removePropertyChangeListener(listener);
instance.ingestModuleEventPublisher.removePropertyChangeListener(listener);
}
/**
* Fire an ingest event signifying an ingest job started.
*