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