mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 01:07:42 +00:00
doFinalSearch() should now wait if the given job still has a search worker running before launching the final search worker.
This commit is contained in:
parent
2c006bec7d
commit
93e466a0b6
@ -169,10 +169,17 @@ public final class SearchRunner {
|
|||||||
|
|
||||||
// Run one last search as there are probably some new files committed
|
// Run one last search as there are probably some new files committed
|
||||||
logger.log(Level.INFO, "Running final search for jobid {0}", job.getJobId());
|
logger.log(Level.INFO, "Running final search for jobid {0}", job.getJobId());
|
||||||
if (!job.getKeywordListNames().isEmpty() && !job.isWorkerRunning()) {
|
if (!job.getKeywordListNames().isEmpty()) {
|
||||||
|
try {
|
||||||
|
// In case this job still has a worker running, wait for it to finish
|
||||||
|
synchronized(this) {
|
||||||
|
while(job.isWorkerRunning()) {
|
||||||
|
this.wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SearchRunner.Searcher finalSearcher = new SearchRunner.Searcher(job, true);
|
SearchRunner.Searcher finalSearcher = new SearchRunner.Searcher(job, true);
|
||||||
finalSearcher.execute();
|
finalSearcher.execute();
|
||||||
try {
|
|
||||||
// block until the search is complete
|
// block until the search is complete
|
||||||
finalSearcher.get();
|
finalSearcher.get();
|
||||||
} catch (InterruptedException | ExecutionException ex) {
|
} catch (InterruptedException | ExecutionException ex) {
|
||||||
@ -198,7 +205,7 @@ public final class SearchRunner {
|
|||||||
for(Entry<Long, SearchJobInfo> j : jobs.entrySet()) {
|
for(Entry<Long, SearchJobInfo> j : jobs.entrySet()) {
|
||||||
SearchJobInfo job = j.getValue();
|
SearchJobInfo job = j.getValue();
|
||||||
if (!job.getKeywordListNames().isEmpty() && !job.isWorkerRunning()) {
|
if (!job.getKeywordListNames().isEmpty() && !job.isWorkerRunning()) {
|
||||||
Searcher s = new Searcher(job, true);
|
Searcher s = new Searcher(job);
|
||||||
s.execute();
|
s.execute();
|
||||||
job.setWorkerRunning(true);
|
job.setWorkerRunning(true);
|
||||||
}
|
}
|
||||||
@ -549,6 +556,12 @@ public final class SearchRunner {
|
|||||||
finalizeSearcher();
|
finalizeSearcher();
|
||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
job.setWorkerRunning(false);
|
job.setWorkerRunning(false);
|
||||||
|
|
||||||
|
// In case the enclosing class instance is waiting on this worker to be done
|
||||||
|
synchronized(SearchRunner.this) {
|
||||||
|
SearchRunner.this.notify();
|
||||||
|
}
|
||||||
|
|
||||||
logger.log(Level.INFO, "Searcher took to run: {0} secs.", stopWatch.getElapsedTimeSecs());
|
logger.log(Level.INFO, "Searcher took to run: {0} secs.", stopWatch.getElapsedTimeSecs());
|
||||||
} finally {
|
} finally {
|
||||||
//searcherLock.unlock();
|
//searcherLock.unlock();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user