You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kalle Korhonen <ka...@gmail.com> on 2009/06/24 21:36:51 UTC

Difference between @Retain and static attributes?

I was using @Retain for some fields that only needed to be initialized
once on a page. However, I see that they are reset after some time has
passed. How does the page pool work - are less used pages removed from
the pool only when other pages push them out or is the cache cleared
periodically? Are there any potential issues using static attributes
instead?

Kalle

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: Difference between @Retain and static attributes?

Posted by "Newham, Cameron" <ca...@bl.uk>.
I've used @Retain in several places.

It is a good idea :-)   I hope you don't have plans to deprecate it.


-----Original Message-----
From: Howard Lewis Ship [mailto:hlship@gmail.com] 
Sent: 24 June 2009 22:11
To: Tapestry users
Subject: Re: Difference between @Retain and static attributes?

@Retain are per-instance which can be much different than a static.

@Retain looked like a good idea at the time, but I have never used it in
a
project.

**************************************************************************
 
Experience the British Library online at www.bl.uk
 
The British Library's new interactive Annual Report and Accounts 2007/08 : www.bl.uk/knowledge
 
Help the British Library conserve the world's knowledge. Adopt a Book. www.bl.uk/adoptabook
 
The Library's St Pancras site is WiFi - enabled
 
*************************************************************************
 
The information contained in this e-mail is confidential and may be legally privileged. It is intended for the addressee(s) only. If you are not the intended recipient, please delete this e-mail and notify the postmaster@bl.uk : The contents of this e-mail must not be disclosed or copied without the sender's consent. 
 
The statements and opinions expressed in this message are those of the author and do not necessarily reflect those of the British Library. The British Library does not take any responsibility for the views of the author. 
 
*************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Difference between @Retain and static attributes?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 24 Jun 2009 18:11:28 -0300, Howard Lewis Ship <hl...@gmail.com>  
escreveu:

> @Retain are per-instance which can be much different than a static.
>
> @Retain looked like a good idea at the time, but I have never used it in  
> a project.

I use it to cache some class-specific values got from services in generic  
abstract pages (Tapestry CRUD' BaseEditPage, for example). In  
BaseEditPage, I need a Controller instance, but it is specific to the  
entity class being edited, and there's one BaseEditPage subclass for each  
entity class. Instead of using my ControllerSource service everytime I  
need a Controller, I @Retain the Controller instance, setting it in  
BaseEditPage's constructor.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Difference between @Retain and static attributes?

Posted by Howard Lewis Ship <hl...@gmail.com>.
@Retain are per-instance which can be much different than a static.

@Retain looked like a good idea at the time, but I have never used it in a
project.

Chances are, if you have some global state that needs to be shared between
users, neither @Retain or a static field is correct ... a shared service is
going to be a better option.

On Wed, Jun 24, 2009 at 12:36 PM, Kalle Korhonen <kalle.o.korhonen@gmail.com
> wrote:

> I was using @Retain for some fields that only needed to be initialized
> once on a page. However, I see that they are reset after some time has
> passed. How does the page pool work - are less used pages removed from
> the pool only when other pages push them out or is the cache cleared
> periodically? Are there any potential issues using static attributes
> instead?
>
> Kalle
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos