Each app instance runs in its own JVM.  So it should be safe to cache
data in ThreadLocal.

On 16 sep, 09:08, Maxim Veksler <ma...@vekslers.org> wrote:
> I would like to cache a not thread safe object, I'm hoping to improve
> performance by caching it instead of instantiating new instance per request.
>
> Thanks,
> Maxim.
>
> On Thu, Sep 16, 2010 at 8:12 AM, Guillaume Laforge <glafo...@gmail.com>wrote:
>
>
>
> > What kind of data or information do you want to share through thread-locals
> > between threads/requests?
>
> > On Thu, Sep 16, 2010 at 08:04, Maxim Veksler <ma...@vekslers.org> wrote:
>
> >> I didn't say multi threaded.
>
> >> ThreadLocal gives access to the cached object of the current thread.
> >> I'm doing an assumption here that appengine/j is implemented with thread
> >> per incoming request.
>
> >> What I would like to know is if these threads are recycled (in which case
> >> ThreadLocal is a good approach) or not.
>
> >> Thanks,
> >> Maxim.
>
> >> On Thu, Sep 16, 2010 at 6:17 AM, Didier Durand 
> >> <durand.did...@gmail.com>wrote:
>
> >>> Hi Maxim,
>
> >>> Multi-threading is not the way to go under GAEJ, see
> >>>http://code.google.com/appe<http://code.google.com/appengine/docs/java/runtime.html#The_Sandbox>
>
> >> *I didn't say multi threaded. *
>
> >> ngine/docs/java/runtime.html#The_Sandbox<http://code.google.com/appengine/docs/java/runtime.html#The_Sandbox>
>
> >>> The right way to go is Tasks:
> >>>http://code.google.com/appengine/docs/java/taskqueue/overview.html
>
> >>> regards
>
> >>> didier
>
> >>> On Sep 15, 2:00 pm, Maxim Veksler <ma...@vekslers.org> wrote:
> >>> > Hello,
>
> >>> > I'm wondering (after some internal discussion we had) is using
> >>> ThreadLocal
> >>> > for applications running on the AppEngine is performance beneficial ?
>
> >>> > For this to work AppEngine should recycle threads, right?
>
> >>> > Another question is how many threads does the appengine allows per JVM
> >>> ?
> >>> > Such ThreadLocal based approach would (probably) be inefficient if the
> >>> JVM
> >>> > allowed 20000 threads.
>
> >>> > Help is appreciated.
> >>> > Maxim.
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Google App Engine for Java" group.
> >>> To post to this group, send email to
> >>> google-appengine-j...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2B
> >>>  unsubscr...@googlegroups.com>
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/google-appengine-java?hl=en.
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "Google App Engine for Java" group.
> >> To post to this group, send email to
> >> google-appengine-j...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2B
> >>  unsubscr...@googlegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/google-appengine-java?hl=en.
>
> > --
> > Guillaume Laforge
> > Groovy Project Manager
> > Head of Groovy Development at SpringSource
> >http://www.springsource.com/g2one
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine for Java" group.
> > To post to this group, send email to
> > google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2B 
> > unsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to