Remove exception firewall from AutopsyEventPublisher

This commit is contained in:
Richard Cordovano 2016-02-26 12:25:16 -05:00
parent 0808079290
commit 38ea8d1df4

View File

@ -86,24 +86,8 @@ public final class AutopsyEventPublisher {
* events from other Autopsy nodes.
*/
public void closeRemoteEventChannel() {
currentChannelName = null;
stopRemotePublisher();
}
/**
* Stops remote event publisher, causing it to disconnect from the message
* service. As opposed to closeRemoteEventChannel(), this method allows for
* the current remote event channel to be re-opened later.
*/
private void stopRemotePublisher() {
if (null != remotePublisher) {
try {
remotePublisher.stop();
} catch (JMSException ex) {
logger.log(Level.SEVERE, "Error closing remote event channel", ex); //NON-NLS
}
remotePublisher = null;
}
currentChannelName = null;
}
/**
@ -171,9 +155,6 @@ public final class AutopsyEventPublisher {
* @param event The event to publish.
*/
public void publishRemotely(AutopsyEvent event) {
/*
* This is a no-op if a remote channel has not been opened.
*/
if (null != currentChannelName) {
boolean published = false;
int tryCount = 1;
@ -185,19 +166,28 @@ public final class AutopsyEventPublisher {
}
remotePublisher.publish(event);
published = true;
} catch (JMSException ex) {
} catch (AutopsyEventException | JMSException ex) {
logger.log(Level.SEVERE, String.format("Failed to publish %s using channel %s (tryCount = %s)", event.getPropertyName(), currentChannelName, tryCount), ex); //NON-NLS
stopRemotePublisher();
++tryCount;
} catch (AutopsyEventException ex) {
logger.log(Level.SEVERE, String.format("Failed to reopen channel %s to publish %s event (tryCount = %s)", currentChannelName, event.getPropertyName(), tryCount), ex); //NON-NLS
++tryCount;
} catch (Exception ex) {
logger.log(Level.SEVERE, String.format("Unexpected exception! Failed to to publish %s event on channel %s (tryCount = %s)", event.getPropertyName(), currentChannelName, tryCount), ex); //NON-NLS
++tryCount;
}
}
}
}
}
/**
* Stops the remote event publisher, but does not reset the current channel
* name.
*/
private void stopRemotePublisher() {
if (null != remotePublisher) {
try {
remotePublisher.stop();
} catch (JMSException ex) {
logger.log(Level.SEVERE, String.format("Error closing remote event publisher for channel %s", currentChannelName), ex); //NON-NLS
}
remotePublisher = null;
}
}
}