How to unregister event that I've registered with eventPublisher

alexeybu September 9, 2012

Hi, I've created plugin with eventPublisher, I've registered listener with eventPublisher.register(this) but I've forgot to unregister it (eventPublisher.unregister). Than I've installed/uninstalled plugin several times and as expected listeners were not unregistered.

Is there any way to unregister this listener without Jira restart?

Thanks in advance.

1 answer

1 accepted

1 vote
Answer accepted
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 9, 2012

When you register the same listener (i.e. with the same key), it unregisters the existing one before the new one is registered. So you must have only one listener in place.

If you add the unregister code and uninstall the plugin, that will remove the listener.

alexeybu September 9, 2012

I've added unregister code to my class, uninstalled previos plugin version, installed new version with unregister code, and uninstalled it (performed several times) but it seems that previos listener is still active because it executes the code which is implemented in the previos plugin version :(

I haven't changed any code in atlassian-plugin.xml so the key should be the same...

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 9, 2012

Bit strange. Are you using atlas-run or doing it in a standalone jira?

alexeybu September 9, 2012

I'm doing that on a standalone jira, but you've adviced me a very useful thing :) I've added unregisterAll before registering listener, installed plugin and all incorrect listeners were successfully removed, so I've removed this unregisterAll and re-installed plugin and now everything is cool :) Thank you very much and sorry for my english!

Trupti Kanase October 5, 2016

@Jobin Kuruvilla [Go2Group]: Can you please specify what is mean by "same key" here?

How can I get the listener key?

Suggest an answer

Log in or Sign up to answer