You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Christopher Dodunski (Tapestry)" <Ch...@christopher.net.nz> on 2020/09/15 22:50:35 UTC
Tapestry services lifecycle
Hi all, just a quick question...
Once a Tapestry service implementation gets instantiated, and that
service's status moves to "realised", at what point does that
implementation get destroyed?
Tapestry instantiates a service implementation the first time a service
method gets called, and I'm just wondering whether the reverse is also
true - eg. released for garbage collection if no method has been called
after a period of time.
In some cases it's needed for a service to retain state, such as keeping
a 'static final' map of connected users. This is thread safe, but would
be lost without a single service implementation instance.
Regards,
Chris.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry services lifecycle
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, Sep 15, 2020 at 7:50 PM Christopher Dodunski (Tapestry) <
ChrisFromTapestry@christopher.net.nz> wrote:
> Hi all, just a quick question...
>
Hello!
> Once a Tapestry service implementation gets instantiated, and that
> service's status moves to "realised", at what point does that
> implementation get destroyed?
>
Only when Tapestry-IoC's Registry instance gets shutdown (i..e. by calling
its shutdown() method), since it keeps references to all service instances.
> Tapestry instantiates a service implementation the first time a service
> method gets called, and I'm just wondering whether the reverse is also
> true - eg. released for garbage collection if no method has been called
> after a period of time.
>
Tapestry-IoC doesn't track whether a service hasn't been called after a
period of time.
>
> In some cases it's needed for a service to retain state, such as keeping
> a 'static final' map of connected users. This is thread safe, but would
> be lost without a single service implementation instance.
>
> Regards,
>
> Chris.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Thiago