Merge pull request #4128 from millmanorama/1030-remove-synchronization

1030 - remove synchronized block
This commit is contained in:
Richard Cordovano 2018-09-20 11:57:45 -04:00 committed by GitHub
commit 945c1b3ea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 37 deletions

View File

@ -344,49 +344,48 @@ public final class ImageGalleryTopComponent extends TopComponent implements Expl
+ "or no groups are fully analyzed but ingest is not running."}) + "or no groups are fully analyzed but ingest is not running."})
private void checkForGroups() { private void checkForGroups() {
GroupManager groupManager = controller.getGroupManager(); GroupManager groupManager = controller.getGroupManager();
synchronized (groupManager) {
if (isNotEmpty(groupManager.getAnalyzedGroups())) {
clearNotification();
return;
}
if (IngestManager.getInstance().isIngestRunning()) { if (isNotEmpty(groupManager.getAnalyzedGroups())) {
clearNotification();
return;
}
if (IngestManager.getInstance().isIngestRunning()) {
if (controller.isListeningEnabled()) {
replaceNotification(centralStack,
new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg2(),
new ProgressIndicator()));
} else {
replaceNotification(fullUIStack,
new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg1()));
}
return;
}
if (controller.getDBTasksQueueSizeProperty().get() > 0) {
replaceNotification(fullUIStack,
new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg3(),
new ProgressIndicator()));
return;
}
try {
if (controller.getDatabase().countAllFiles() <= 0) {
// there are no files in db
if (controller.isListeningEnabled()) { if (controller.isListeningEnabled()) {
replaceNotification(centralStack, replaceNotification(fullUIStack,
new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg2(), new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg5()));
new ProgressIndicator()));
} else { } else {
replaceNotification(fullUIStack, replaceNotification(fullUIStack,
new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg1())); new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg4()));
} }
return; return;
} }
if (controller.getDBTasksQueueSizeProperty().get() > 0) { } catch (TskCoreException tskCoreException) {
replaceNotification(fullUIStack, logger.log(Level.SEVERE, "Error counting files in the database.", tskCoreException);
new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg3(), }
new ProgressIndicator()));
return;
}
try {
if (controller.getDatabase().countAllFiles() <= 0) {
// there are no files in db
if (controller.isListeningEnabled()) {
replaceNotification(fullUIStack,
new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg5()));
} else {
replaceNotification(fullUIStack,
new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg4()));
}
return;
}
} catch (TskCoreException tskCoreException) {
logger.log(Level.SEVERE, "Error counting files in the database.", tskCoreException);
}
if (false == groupManager.isRegrouping()) { if (false == groupManager.isRegrouping()) {
replaceNotification(centralStack, replaceNotification(centralStack,
new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg6())); new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg6()));
}
} }
} }

View File

@ -232,9 +232,8 @@ public class GroupManager {
} }
public boolean isRegrouping() { public boolean isRegrouping() {
Worker.State state = regrouper.getState();
return Arrays.asList(Worker.State.READY, Worker.State.RUNNING, Worker.State.SCHEDULED) return Arrays.asList(Worker.State.READY, Worker.State.RUNNING, Worker.State.SCHEDULED)
.contains(state); .contains(regrouper.getState());
} }
public ReadOnlyObjectProperty<Worker.State> reGroupingState() { public ReadOnlyObjectProperty<Worker.State> reGroupingState() {