Re: Tapestry & Hivemind: Caching multiple method calls per request?

2007-02-09 Thread Tobias Marx
That's a good point. I would have assumed a

 on 5 different locations 
inside a page would return exactly the same timestamp as Tapestry "assumes" 
that all identical ognl expressions are the same and the expression is only 
evaluated once before rendering the page.

If, however, the the ognl expressions are evaluated one by one and while the 
templates are being parsed, this would lead to different timestamps.

My idea was, that the steps are the following:

1. extraction of the ognl expresions inside a page template and evaluating 
themtemporarily storing the values.

2. rendering the templates using the values from 1.



 Original-Nachricht 
Datum: Fri, 9 Feb 2007 18:01:09 -0500
Von: "James Carman" <[EMAIL PROTECTED]>
An: "Tapestry users" 
CC: 
Betreff: Re: Tapestry & Hivemind: Caching multiple method calls per request?

> Tapestry would have to know what's inside the method to know that it
> will always return the same thing.  This method doesn't return the
> same thing all the time:
> 
> public String getTimestamp()
> {
>   return String.valueOf( System.currentTimeMillis() );
> }
> 
> 
> 
> On 2/9/07, Tobias Marx <[EMAIL PROTECTED]> wrote:
> > Indepenent of what the method looks like, why is it called more then
> once anyhow?
> >
> > If there is the same method inside a page or component, I thought
> Tapestry retrieves all the data first and then "intelligently" parses all the
> pages and its component templates and notices if the same method is called
> several times?
> >
> > Now it seems like it goes through all templates line by line and then
> calls the methods every time it encounteres them without "an eye" for the
> page scope?
> >
> > If I define a class as threaded in Hivemind, doesnt Tapestry "know" that
> the method will always return the same result if it appears 100 times
> inside a page or component?
> >
> > If there is an injected method in some components and pages that
> references a threaded Hivemind class.it is always the same call and 
> therefore
> Tapestry would only need to call it once and use the same result for all
> components?
> >
> >
> > Thanks!
> >
> > Toby
> >
> >  Original-Nachricht 
> > Datum: Fri, 9 Feb 2007 10:24:05 -0500
> > Von: "James Carman" <[EMAIL PROTECTED]>
> > An: "Tapestry users" 
> > CC:
> > Betreff: Re: Tapestry & Hivemind: Caching multiple method calls per
> request?
> >
> > > What does the method that fetches the domain object look like?  Does
> > > it cache its results or does it call the IDomainSource every time?
> > >
> > > On 2/9/07, Tobias Marx <[EMAIL PROTECTED]> wrote:
> > > > Hi there!
> > > >
> > > > I am using Hivemind to generate a Map of Domain name related objects
> as
> > > a singleton on startup, called HibernateDomainSource.
> > > >
> > > > Then I am constructing a threaded services that uses this data
> > > > together with the servletRequest. This service is called
> DomainManager.
> > > >
> > > > I am now injecting the DomainManager into my base component in order
> to
> > > access a domain object from the HibernateDomainSource that corresponds
> to
> > > the domain name from the servlet Request.
> > > >
> > > >  > > interface="tm.framework.services.interfaces.IDomainSource">
> > > > 
> > > >  > > class="tm.framework.services.HibernateDomainSource">
> > > >  > > property="templatePersistenceService"
> service-id="TemplatePersistenceService"/>
> > > > 
> > > > 
> > > >
> > > > 
> > > >
> > > >  > > interface="tm.framework.services.interfaces.DomainManager">
> > > > 
> > > >  > > class="tm.framework.services.DomainManagerImpl">
> > > >  > > service-id="HibernateDomainSource"/>
> > > >  property="servletRequest"
> > > service-id="tapestry.globals.HttpServletRequest" />
> > > > 
> > > > 
> > > > 
> 

Re: Tapestry & Hivemind: Caching multiple method calls per request?

2007-02-09 Thread James Carman

Tapestry would have to know what's inside the method to know that it
will always return the same thing.  This method doesn't return the
same thing all the time:

public String getTimestamp()
{
 return String.valueOf( System.currentTimeMillis() );
}



On 2/9/07, Tobias Marx <[EMAIL PROTECTED]> wrote:

Indepenent of what the method looks like, why is it called more then once 
anyhow?

If there is the same method inside a page or component, I thought Tapestry retrieves all 
the data first and then "intelligently" parses all the pages and its component 
templates and notices if the same method is called several times?

Now it seems like it goes through all templates line by line and then calls the methods 
every time it encounteres them without "an eye" for the page scope?

If I define a class as threaded in Hivemind, doesnt Tapestry "know" that the 
method will always return the same result if it appears 100 times inside a page or 
component?

If there is an injected method in some components and pages that references a 
threaded Hivemind class.it is always the same call and therefore Tapestry 
would only need to call it once and use the same result for all components?


Thanks!

Toby

 Original-Nachricht 
Datum: Fri, 9 Feb 2007 10:24:05 -0500
Von: "James Carman" <[EMAIL PROTECTED]>
An: "Tapestry users" 
CC:
Betreff: Re: Tapestry & Hivemind: Caching multiple method calls per request?

> What does the method that fetches the domain object look like?  Does
> it cache its results or does it call the IDomainSource every time?
>
> On 2/9/07, Tobias Marx <[EMAIL PROTECTED]> wrote:
> > Hi there!
> >
> > I am using Hivemind to generate a Map of Domain name related objects as
> a singleton on startup, called HibernateDomainSource.
> >
> > Then I am constructing a threaded services that uses this data
> > together with the servletRequest. This service is called DomainManager.
> >
> > I am now injecting the DomainManager into my base component in order to
> access a domain object from the HibernateDomainSource that corresponds to
> the domain name from the servlet Request.
> >
> >  interface="tm.framework.services.interfaces.IDomainSource">
> > 
> >  class="tm.framework.services.HibernateDomainSource">
> >  property="templatePersistenceService" 
service-id="TemplatePersistenceService"/>
> > 
> > 
> >
> > 
> >
> >  interface="tm.framework.services.interfaces.DomainManager">
> > 
> >  class="tm.framework.services.DomainManagerImpl">
> >  service-id="HibernateDomainSource"/>
> >  service-id="tapestry.globals.HttpServletRequest" />
> > 
> > 
> > 
> >
> > The "problem" now is, that the DomainManager method that fetches the
> domain object from the map is called several times during a single page
> request.
> >
> > Is there a way to force it to only fetch it once per page request?
> >
> > Thanks!
> >
> > Toby
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tapestry & Hivemind: Caching multiple method calls per request?

2007-02-09 Thread Tobias Marx
Indepenent of what the method looks like, why is it called more then once 
anyhow?

If there is the same method inside a page or component, I thought Tapestry 
retrieves all the data first and then "intelligently" parses all the pages and 
its component templates and notices if the same method is called several times?

Now it seems like it goes through all templates line by line and then calls the 
methods every time it encounteres them without "an eye" for the page scope?

If I define a class as threaded in Hivemind, doesnt Tapestry "know" that the 
method will always return the same result if it appears 100 times inside a page 
or component? 

If there is an injected method in some components and pages that references a 
threaded Hivemind class.it is always the same call and therefore Tapestry 
would only need to call it once and use the same result for all components?


Thanks!

Toby

 Original-Nachricht 
Datum: Fri, 9 Feb 2007 10:24:05 -0500
Von: "James Carman" <[EMAIL PROTECTED]>
An: "Tapestry users" 
CC: 
Betreff: Re: Tapestry & Hivemind: Caching multiple method calls per request?

> What does the method that fetches the domain object look like?  Does
> it cache its results or does it call the IDomainSource every time?
> 
> On 2/9/07, Tobias Marx <[EMAIL PROTECTED]> wrote:
> > Hi there!
> >
> > I am using Hivemind to generate a Map of Domain name related objects as
> a singleton on startup, called HibernateDomainSource.
> >
> > Then I am constructing a threaded services that uses this data
> > together with the servletRequest. This service is called DomainManager.
> >
> > I am now injecting the DomainManager into my base component in order to
> access a domain object from the HibernateDomainSource that corresponds to
> the domain name from the servlet Request.
> >
> >  interface="tm.framework.services.interfaces.IDomainSource">
> > 
> >  class="tm.framework.services.HibernateDomainSource">
> >  property="templatePersistenceService" 
> service-id="TemplatePersistenceService"/>
> > 
> > 
> >
> > 
> >
> >  interface="tm.framework.services.interfaces.DomainManager">
> > 
> >  class="tm.framework.services.DomainManagerImpl">
> >  service-id="HibernateDomainSource"/>
> >  service-id="tapestry.globals.HttpServletRequest" />
> > 
> > 
> > 
> >
> > The "problem" now is, that the DomainManager method that fetches the
> domain object from the map is called several times during a single page
> request.
> >
> > Is there a way to force it to only fetch it once per page request?
> >
> > Thanks!
> >
> > Toby
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tapestry & Hivemind: Caching multiple method calls per request?

2007-02-09 Thread James Carman

What does the method that fetches the domain object look like?  Does
it cache its results or does it call the IDomainSource every time?

On 2/9/07, Tobias Marx <[EMAIL PROTECTED]> wrote:

Hi there!

I am using Hivemind to generate a Map of Domain name related objects as a 
singleton on startup, called HibernateDomainSource.

Then I am constructing a threaded services that uses this data
together with the servletRequest. This service is called DomainManager.

I am now injecting the DomainManager into my base component in order to access 
a domain object from the HibernateDomainSource that corresponds to the domain 
name from the servlet Request.



















The "problem" now is, that the DomainManager method that fetches the domain 
object from the map is called several times during a single page request.

Is there a way to force it to only fetch it once per page request?

Thanks!

Toby

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Tapestry & Hivemind: Caching multiple method calls per request?

2007-02-09 Thread Tobias Marx
Hi there!

I am using Hivemind to generate a Map of Domain name related objects as a 
singleton on startup, called HibernateDomainSource.

Then I am constructing a threaded services that uses this data  
together with the servletRequest. This service is called DomainManager.

I am now injecting the DomainManager into my base component in order to access 
a domain object from the HibernateDomainSource that corresponds to the domain 
name from the servlet Request.



















The "problem" now is, that the DomainManager method that fetches the domain 
object from the map is called several times during a single page request.

Is there a way to force it to only fetch it once per page request?

Thanks!

Toby

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]