Merge pull request #1588 from karlmortensen/addressDeadlock

Address deadlock when service manager cancels jobs due to a service o…
This commit is contained in:
Richard Cordovano 2015-09-24 11:10:52 -04:00
commit 5734522a3d

View File

@ -68,6 +68,7 @@ public class IngestManager {
private static final Logger logger = Logger.getLogger(IngestManager.class.getName());
private static IngestManager instance;
private final Object ingestMessageBoxLock = new Object();
/**
* The ingest manager maintains a mapping of ingest job IDs to running
@ -435,15 +436,18 @@ public class IngestManager {
* display ingest messages.
*/
void initIngestMessageInbox() {
synchronized (this.ingestMessageBoxLock) {
ingestMessageBox = IngestMessageTopComponent.findInstance();
}
}
/**
* Post a message to the ingest messages in box.
*
* @param message The message to be posted.
*/
synchronized void postIngestMessage(IngestMessage message) {
void postIngestMessage(IngestMessage message) {
synchronized (this.ingestMessageBoxLock) {
if (ingestMessageBox != null && this.runInteractively) {
if (message.getMessageType() != IngestMessage.MessageType.ERROR && message.getMessageType() != IngestMessage.MessageType.WARNING) {
ingestMessageBox.displayMessage(message);
@ -461,13 +465,16 @@ public class IngestManager {
}
}
}
}
private void clearIngestMessageBox() {
synchronized (this.ingestMessageBoxLock) {
if (ingestMessageBox != null) {
ingestMessageBox.clearMessages();
}
ingestErrorMessagePosts.set(0);
}
}
/**
* Gets the number of file ingest threads the ingest manager will use to do