mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 07:56:16 +00:00
4288 Make executor in ImageGalleryController final
This commit is contained in:
parent
21a279063b
commit
e81ebfac76
@ -114,7 +114,7 @@ public final class ImageGalleryController {
|
||||
private final CategoryManager categoryManager;
|
||||
private final DrawableTagsManager tagsManager;
|
||||
|
||||
private ListeningExecutorService dbExecutor;
|
||||
private final ListeningExecutorService dbExecutor;
|
||||
|
||||
private final Case autopsyCase;
|
||||
private final SleuthkitCase sleuthKitCase;
|
||||
@ -347,8 +347,8 @@ public final class ImageGalleryController {
|
||||
* Returns a set of data source object ids that are stale.
|
||||
*
|
||||
* This includes any data sources already in the table, that are not in
|
||||
* COMPLETE or IN_PROGRESS status, or any data sources that might have been added to the
|
||||
* case, but are not in the datasources table.
|
||||
* COMPLETE or IN_PROGRESS status, or any data sources that might have been
|
||||
* added to the case, but are not in the datasources table.
|
||||
*
|
||||
* @return list of data source object ids that are stale.
|
||||
*/
|
||||
@ -496,15 +496,12 @@ public final class ImageGalleryController {
|
||||
}
|
||||
|
||||
synchronized private void shutDownDBExecutor() {
|
||||
if (dbExecutor != null) {
|
||||
dbExecutor.shutdownNow();
|
||||
try {
|
||||
dbExecutor.awaitTermination(30, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException ex) {
|
||||
logger.log(Level.WARNING, "Image Gallery failed to shutdown DB Task Executor in a timely fashion.", ex);
|
||||
}
|
||||
dbExecutor = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static ListeningExecutorService getNewDBExecutor() {
|
||||
@ -518,12 +515,10 @@ public final class ImageGalleryController {
|
||||
* @param bgTask
|
||||
*/
|
||||
public synchronized void queueDBTask(BackgroundTask bgTask) {
|
||||
if (dbExecutor == null || dbExecutor.isShutdown()) {
|
||||
dbExecutor = getNewDBExecutor();
|
||||
}
|
||||
if (!dbExecutor.isShutdown()) {
|
||||
incrementQueueSize();
|
||||
dbExecutor.submit(bgTask).addListener(this::decrementQueueSize, MoreExecutors.directExecutor());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void incrementQueueSize() {
|
||||
@ -629,7 +624,6 @@ public final class ImageGalleryController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* task that updates one file in database with results from ingest
|
||||
*/
|
||||
@ -666,7 +660,6 @@ public final class ImageGalleryController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Base abstract class for various methods of copying image files data, for
|
||||
* a given data source, into the Image gallery DB.
|
||||
@ -675,6 +668,7 @@ public final class ImageGalleryController {
|
||||
"BulkTask.stopCopy.status=Stopping copy to drawable db task.",
|
||||
"BulkTask.errPopulating.errMsg=There was an error populating Image Gallery database."})
|
||||
abstract static class BulkTransferTask extends BackgroundTask {
|
||||
|
||||
static private final String MIMETYPE_CLAUSE
|
||||
= "(mime_type LIKE '" //NON-NLS
|
||||
+ String.join("' OR mime_type LIKE '", FileTypeUtils.getAllSupportedMimeTypes()) //NON-NLS
|
||||
@ -751,7 +745,6 @@ public final class ImageGalleryController {
|
||||
updateProgress(0.0);
|
||||
int workDone = 0;
|
||||
|
||||
|
||||
// Cycle through all of the files returned and call processFile on each
|
||||
//do in transaction
|
||||
drawableDbTransaction = taskDB.beginTransaction();
|
||||
@ -772,7 +765,6 @@ public final class ImageGalleryController {
|
||||
endedEarly = true;
|
||||
progressHandle.finish();
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user