Skip to content

Instantly share code, notes, and snippets.

@tomasfrancisco
Created October 25, 2016 18:41
Show Gist options
  • Save tomasfrancisco/2c0ea688ac5e0835f117a60f0753299b to your computer and use it in GitHub Desktop.
Save tomasfrancisco/2c0ea688ac5e0835f117a60f0753299b to your computer and use it in GitHub Desktop.
Terminate a program running a thread before.
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
try {
rt.stopReceiverTopic();
rq.stopReceiverQueue();
} catch (JMSException e) {
e.printStackTrace();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment