polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Merlin <p...@nosphere.org>
Subject Re: service initialization order?
Date Sun, 12 Jun 2016 12:36:11 GMT

zhuangmz08 a écrit :
> 3.  Could you explain more details on the life cycle of a service?
>   beforeConstructor -> constructor -> postConstructor -> beforeActivation ->
activate -> postActivation -> beforePassivation -> passavate -> afterPassivation?
> Thanks a lot.

By default, services are not instanciated until they are used, unless
they are assembled with instantiateOnStartup();

Services lifecycle is as follow:

1. service composite creation
    a. composite instanciation, eventually with ctor injection
    b. fields injection
    c. composite initialization
2. service activation
    a. before activation
    b. activation
    c. after activation
3. service passivation
    a. before passivation
    b. passivation
    c. after passivation

Please see the documentation for how to hook in activation/passivation
- for 2.1
- for develop

You can also hook into the composite lifecycle, which applies to all
composite types (1.c. in the list above). Simply implement Initializable
in your Service composite, the initialize() method will then be called
by the Zest runtime.



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message