Thank you for rapid reply! Trying to implement it using addShutdownHook to keep it as simple as possible. Edward.
On Wed, Aug 24, 2016 at 3:20 PM Thomas Mortagne <thomas.morta...@xwiki.com> wrote: > On Wed, Aug 24, 2016 at 9:33 AM, Vincent Massol <vinc...@massol.net> > wrote: > > Hi, > > > >> On 24 Aug 2016, at 09:11, Edward Knyshov <edv...@gmail.com> wrote: > >> > >> Hello. > >> How can I execute some java code when xwiki is about to shut down? > > > > Option 1: > > > > XWiki is a java app so all you can write some java class with a shutdown > hook, something like Runtime.getRuntime().addShutdownHook. > > > > Then you package your class in a jar and drop it in WEB-INF/lib. > > > > > Option 2: > > > > You write an XWiki component and implement the Disposable interface. > > See > http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HComponentDisposal > > This only works if your component is initialized before the shutdown > so you will need a component which is always initialized like event > listeners. > > Option 3: > > Implement an event listener component listening to > org.xwiki.observation.event.ApplicationStoppedEvent event. > > > > > Thanks > > -Vincent > > > > > >> Thanks, Edward. > >> > > _______________________________________________ > > users mailing list > > users@xwiki.org > > http://lists.xwiki.org/mailman/listinfo/users > > > > -- > Thomas Mortagne > _______________________________________________ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users > _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users