Liferay startup events explanation

637 views Asked by At

1) I was trying to create a portal startup hook, and was overwriting a startup action. The wording in application.startup.events description was a bit vague: it says that this event runs once for every web site instance of the portal that initializes. Does 'web site instance of the portal' mean the same as 'portal' instance?

2) Whenever I redeploy my hook, my application startup event action gets called. Does it mean that the portal instance reinitializes? If so, why don't I observe the same behavior if I redeploy other plugins? (When I redeploy other plugins, startup event action doesn't get called)

3) When I try to overwrite global.startup.events instead of application.startup.events in my hook, my startup action never gets called (I inserted some print statements into the startup method and restarted the server). How can this behavior be explained?

I'd appreciate if you answer even partly, since it would still benefit me and probably the community. Thanks in advance

1

There are 1 answers

0
Olaf Kock On BEST ANSWER

A hook is deployed as a web application. Thus an application.startup.events-configured action will fire when the hook gets deployed. AFAIK it will be called with all available instance ids (technically companyId). It seems that the wording in the documentation is unfortunate. However, as all webapplications deploy independent of each other, this is the best effort that's available. And if you update your hook's code and redeploy it, you might want to run the changed startup event.

global.startup.events can not be configured in a hook, thus you see no activity - it's strictly ignored.