You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by David Rees <dr...@gmail.com> on 2011/04/08 06:36:03 UTC

T5.2 BindingPrefixCycle not thread safe

http://wiki.apache.org/tapestry/Tapestry5HowToAddBindingPrefixCycle

I notice that using the above code in T5.2 results in arbitrary
results now on T5.2 if multiple requests are executing at the same
time.

It appears that the same CycleBinding ends up being used across
requests.  It seems that we'd want a pool of these used (which is
probably why it worked with the page-pool in T5.1).

Is this a bug with T5.2 or is this an issue with the CycleBinding
implementation?

Thanks

Dave

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


Re: T5.2 BindingPrefixCycle not thread safe

Posted by David Rees <dr...@gmail.com>.
On Fri, Apr 8, 2011 at 1:43 PM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> On Fri, 08 Apr 2011 16:59:26 -0300, David Rees <dr...@gmail.com> wrote:
>> Yep, did that and it works great now.  Should I update the wiki or
>> something?
>
> Please do it. Thanks in advance. :)

Done.

http://wiki.apache.org/tapestry/Tapestry5HowToAddBindingPrefixCycle

-Dave

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


Re: T5.2 BindingPrefixCycle not thread safe

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 08 Apr 2011 16:59:26 -0300, David Rees <dr...@gmail.com> wrote:

> Yep, did that and it works great now.  Should I update the wiki or  
> something?

Please do it. Thanks in advance. :)

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: T5.2 BindingPrefixCycle not thread safe

Posted by David Rees <dr...@gmail.com>.
On Fri, Apr 8, 2011 at 12:01 PM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> On Fri, 08 Apr 2011 15:44:43 -0300, Joe Klecko <bu...@gmail.com> wrote:
>> DOH!  Nice find David.   I've been using this binding in several T5.1
>> projects and now starting to use it in T5.2 projects.  Thiago is there an
>> easy T5 way to make it thread safe or should the index value be stored
>> using something like ThreadLocal?
>
> I'd go for ThreadLocal.

Yep, did that and it works great now.  Should I update the wiki or something?

-Dave

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


Re: T5.2 BindingPrefixCycle not thread safe

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 08 Apr 2011 15:44:43 -0300, Joe Klecko <bu...@gmail.com> wrote:

> DOH!  Nice find David.   I've been using this binding in several T5.1
> projects and now starting to use it in T5.2 projects.  Thiago is there an
> easy T5 way to make it thread safe or should the index value be stored  
> using something like ThreadLocal?

I'd go for ThreadLocal.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: T5.2 BindingPrefixCycle not thread safe

Posted by Howard Lewis Ship <hl...@gmail.com>.
On Fri, Apr 8, 2011 at 12:06 PM, Igor Drobiazko
<ig...@gmail.com> wrote:
> You can use the PerthreadManager service.
>
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/services/PerthreadManager.html

This is preferred.

It ensures that everything is cleaned up at the end of the request
with non memory (including class loader) leaks.

>
> On Fri, Apr 8, 2011 at 8:44 PM, Joe Klecko <bu...@gmail.com> wrote:
>
>> DOH!  Nice find David.   I've been using this binding in several T5.1
>> projects and now starting to use it in T5.2 projects.  Thiago is there an
>> easy T5 way to make it thread safe or should the index value be stored
>> using
>> something like ThreadLocal?
>>
>> Also even though the page
>> (http://wiki.apache.org/tapestry/Tapestry5HowToAddBindingPrefixCycle) is
>> not
>> official documentation, it should really be updated to let T5.2 users know
>> its not thread safe (or update the code to be thread safe).
>>
>> Thanks,
>> J
>>
>> --
>> View this message in context:
>> http://tapestry.1045711.n5.nabble.com/T5-2-BindingPrefixCycle-not-thread-safe-tp4290039p4291673.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
>>
>>
>
>
> --
> Best regards,
>
> Igor Drobiazko
> http://tapestry5.de
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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


Re: T5.2 BindingPrefixCycle not thread safe

Posted by Igor Drobiazko <ig...@gmail.com>.
You can use the PerthreadManager service.

http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/services/PerthreadManager.html

On Fri, Apr 8, 2011 at 8:44 PM, Joe Klecko <bu...@gmail.com> wrote:

> DOH!  Nice find David.   I've been using this binding in several T5.1
> projects and now starting to use it in T5.2 projects.  Thiago is there an
> easy T5 way to make it thread safe or should the index value be stored
> using
> something like ThreadLocal?
>
> Also even though the page
> (http://wiki.apache.org/tapestry/Tapestry5HowToAddBindingPrefixCycle) is
> not
> official documentation, it should really be updated to let T5.2 users know
> its not thread safe (or update the code to be thread safe).
>
> Thanks,
> J
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/T5-2-BindingPrefixCycle-not-thread-safe-tp4290039p4291673.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
>
>


-- 
Best regards,

Igor Drobiazko
http://tapestry5.de

Re: T5.2 BindingPrefixCycle not thread safe

Posted by Joe Klecko <bu...@gmail.com>.
DOH!  Nice find David.   I've been using this binding in several T5.1
projects and now starting to use it in T5.2 projects.  Thiago is there an
easy T5 way to make it thread safe or should the index value be stored using
something like ThreadLocal?

Also even though the page
(http://wiki.apache.org/tapestry/Tapestry5HowToAddBindingPrefixCycle) is not
official documentation, it should really be updated to let T5.2 users know
its not thread safe (or update the code to be thread safe).

Thanks,
J

--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-2-BindingPrefixCycle-not-thread-safe-tp4290039p4291673.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.2 BindingPrefixCycle not thread safe

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 08 Apr 2011 01:36:03 -0300, David Rees <dr...@gmail.com> wrote:

> http://wiki.apache.org/tapestry/Tapestry5HowToAddBindingPrefixCycle

Remember that this isn't part of the official documentation, so the  
quality of the pages vary a lot.

> It appears that the same CycleBinding ends up being used across
> requests.  It seems that we'd want a pool of these used (which is
> probably why it worked with the page-pool in T5.1).
> Is this a bug with T5.2 or is this an issue with the CycleBinding
> implementation?

I'd guess its a CycleBinding error, as it's definetely not thread-safe.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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