Skip to content

issue #1992 redirect status to log service if threading service has shut down #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/main/java/org/scijava/app/DefaultStatusService.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@

package org.scijava.app;

import java.util.concurrent.RejectedExecutionException;

import org.scijava.app.event.StatusEvent;
import org.scijava.event.EventService;
import org.scijava.log.LogService;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;
import org.scijava.service.AbstractService;
Expand All @@ -57,6 +60,9 @@ public class DefaultStatusService extends AbstractService implements

@Parameter
private AppService appService;

@Parameter
private LogService logService;

// -- StatusService methods --

Expand Down Expand Up @@ -113,7 +119,14 @@ public String getStatusMessage(final String appName,
*/
protected void publish(final StatusEvent statusEvent)
{
eventService.publishLater(statusEvent);
try {
eventService.publishLater(statusEvent);
} catch (RejectedExecutionException e) {
// This exception is thrown after the thread service
// shuts down and the queue for later operations
// is no longer available.
logService.info(statusEvent.getStatusMessage());
}
}

}