Re: [xwiki-users] Shutdown hook

2016-08-24 Thread Edward Knyshov
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 
wrote:

> On Wed, Aug 24, 2016 at 9:33 AM, Vincent Massol 
> wrote:
> > Hi,
> >
> >> On 24 Aug 2016, at 09:11, Edward Knyshov  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


Re: [xwiki-users] Shutdown hook

2016-08-24 Thread Thomas Mortagne
On Wed, Aug 24, 2016 at 9:33 AM, Vincent Massol  wrote:
> Hi,
>
>> On 24 Aug 2016, at 09:11, Edward Knyshov  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


Re: [xwiki-users] Shutdown hook

2016-08-24 Thread Vincent Massol
Hi,

> On 24 Aug 2016, at 09:11, Edward Knyshov  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

Thanks
-Vincent


> Thanks, Edward.
> 
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] Shutdown hook

2016-08-24 Thread Edward Knyshov
Hello.
How can I execute some java code when xwiki is about to shut down?
Thanks, Edward.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users