On Wed, Aug 24, 2016 at 9:33 AM, Vincent Massol <[email protected]> wrote: > Hi, > >> On 24 Aug 2016, at 09:11, Edward Knyshov <[email protected]> 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 > [email protected] > http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
