You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by DavidWei <xi...@rrd.com> on 2008/04/08 23:08:03 UTC

T5: when is a filed with @Retain cleaned?

I am using T5 for my current application. There are cases when I need to have
a field's value retain after the request. I know using @Persist it will
work, but I do not want to store so many values in session. I found there
are some samples which use @Retain. By definition, it is said as "By marking
such fields with the Retain annotation, the fields will not be discarded at
the end of the request... This is quite different from Persist, because the
value that's allowed to be retained is not stored persistently; it is simply
not cleared out...".

If it is not cleaned out after the request, when is it cleaned out?

Thanks,

David
-- 
View this message in context: http://www.nabble.com/T5%3A-when-is-a-filed-with-%40Retain-cleaned--tp16573382p16573382.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: when is a filed with @Retain cleaned?

Posted by Howard Lewis Ship <hl...@gmail.com>.
Exactly; @Retain is your way of saying to Tapestry "this field is not
final, but don't worry, I've got it under control."  With @Retain,
Tapestry effectively ignores the field entirely.  This can be enough
rope to hang yourself (in terms of dangling references to objects that
should be garbage collected, or accidentally sharing user-specific
state between different users), which is why this is not the default
behavior for otherwise un-annotated fields.

On Tue, Apr 8, 2008 at 2:43 PM, Filip S. Adamsen <fs...@fsadev.com> wrote:
> org.apache.tapestry.annotations
>  Annotation Type Retain
>
>  Marker annotation placed on fields whose value should be retained past the
> end of the request. This is most often associated with fields that are
> lazily loaded. By marking such fields with the Retain annotation, the fields
> will not be discarded at the end of the request.
>
>  This is quite different from Persist, because the value that's allowed to
> be retained is not stored persistently; it is simply not cleared out. A
> subsequent request, even from the same user, may be processed by a different
> instance of the page where the value is still null.
>
>  This annotation should only be used with lazily-evaluated objects that
> contain no client-specific information.
>
>
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/annotations/Retain.html
>
>  -Filip
>
>
>  On 2008-04-08 23:08, DavidWei wrote:
>
> > I am using T5 for my current application. There are cases when I need to
> have
> > a field's value retain after the request. I know using @Persist it will
> > work, but I do not want to store so many values in session. I found there
> > are some samples which use @Retain. By definition, it is said as "By
> marking
> > such fields with the Retain annotation, the fields will not be discarded
> at
> > the end of the request... This is quite different from Persist, because
> the
> > value that's allowed to be retained is not stored persistently; it is
> simply
> > not cleared out...".
> >
> > If it is not cleaned out after the request, when is it cleaned out?
> >
> > Thanks,
> >
> > David
> >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: T5: when is a filed with @Retain cleaned?

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
org.apache.tapestry.annotations
Annotation Type Retain

Marker annotation placed on fields whose value should be retained past 
the end of the request. This is most often associated with fields that 
are lazily loaded. By marking such fields with the Retain annotation, 
the fields will not be discarded at the end of the request.

This is quite different from Persist, because the value that's allowed 
to be retained is not stored persistently; it is simply not cleared out. 
A subsequent request, even from the same user, may be processed by a 
different instance of the page where the value is still null.

This annotation should only be used with lazily-evaluated objects that 
contain no client-specific information.

http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/annotations/Retain.html

-Filip

On 2008-04-08 23:08, DavidWei wrote:
> I am using T5 for my current application. There are cases when I need to have
> a field's value retain after the request. I know using @Persist it will
> work, but I do not want to store so many values in session. I found there
> are some samples which use @Retain. By definition, it is said as "By marking
> such fields with the Retain annotation, the fields will not be discarded at
> the end of the request... This is quite different from Persist, because the
> value that's allowed to be retained is not stored persistently; it is simply
> not cleared out...".
> 
> If it is not cleaned out after the request, when is it cleaned out?
> 
> Thanks,
> 
> David

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