{
try
{
final DestinationConfigTreeNode tNode = (DestinationConfigTreeNode) node;
final HermesTreeNode hNode = (HermesTreeNode) tNode.getHermesTreeNode();
final DestinationConfig dConfig = tNode.getConfig();
if (dConfig.isDurable())
{
if (JOptionPane.showConfirmDialog(HermesBrowser.getBrowser(), "Would you like to unsubscribe from durable subscription clientID="
+ dConfig.getClientID() + " on " + tNode.getDestinationName(), "Please confirm", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
{
Hermes.ui.getThreadPool().invokeLater(new Runnable()
{
public void run()
{
try
{
hNode.getHermes().unsubscribe(dConfig.getClientID());
Hermes.ui.getDefaultMessageSink().add("Unsubscribed");
}
catch (Throwable e)
{
HermesBrowser.getBrowser().showErrorDialog("Unable to unsubscribe", e);
}
finally
{
try
{
hNode.getHermes().close();
}
catch (Throwable t)
{
log.error(t.getMessage(), t);
}
}
}
});
}
else
{
Hermes.ui.getDefaultMessageSink().add("Unsubscribe cancelled.");
}
}
else
{
HermesBrowser.getBrowser().showErrorDialog("Topic " + dConfig.getName() + " is not configured as durable.") ;
}
}
catch (Throwable t)
{