Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to execute code on deasctivation of a module?

Steve Gerstner [bridgingIT]
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.
July 1, 2015

Hi 

in a plain felix environment I can use @Deactivate to define a method which is called on the deactivation of the service.

 

How can I achive this for a JIRA component?

 

Regards

Steve

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
crf
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 1, 2015

There are a few options, some better than others depending on what you are trying to do.  Be aware that when any of these things happen, part of your plugin may already be gone, so it isn't always safe to communicate outside the module that is shutting down.

  • Define your component as a DisposableBean (from Spring) and use the destroy method.
  • Register an EventListener for PluginModuleDisabledEvent.
  • In JIRA 7.0, LifecycleAware from SAL will get an onStop() method.

There are probably others, but those are the ones I generally use, and for most purposes I find DisposableBean to be easiest.

TAGS
AUG Leaders

Atlassian Community Events