Skip to content

Commit

Permalink
Merge pull request #194 from lucasponce/HWKALERTS-154
Browse files Browse the repository at this point in the history
HWKALERTS-154 Do not thrown Exception on BusActionPluginListener#close
  • Loading branch information
lucasponce committed Jul 5, 2016
2 parents 3b09c53 + 2e656b4 commit 5267d90
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015 Red Hat, Inc. and/or its affiliates
* Copyright 2015-2016 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -92,11 +92,15 @@ protected void onBasicMessage(BusActionMessage basicMessage) {
}

@PreDestroy
public void close() throws Exception {
public void close() {
Collection<ActionPluginSender> senders = ActionPlugins.getSenders().values();
for (ActionPluginSender sender: senders) {
if (sender instanceof BusActionPluginSender) {
((BusActionPluginSender)sender).close();
try {
((BusActionPluginSender)sender).close();
} catch (Exception e) {
msgLog.error("Error closing sender [" + sender.toString() + "]", e);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,11 @@ public void send(ActionResponseMessage msg) throws Exception {
msgLog.errorCannotSendMessage(e.getMessage());
}
}

@Override
public String toString() {
return "BusActionPluginSender[" +
"actionPlugin='" + actionPlugin + '\'' +
']';
}
}

0 comments on commit 5267d90

Please sign in to comment.