Hello everyone!
I am a bit confused. I thought the default service binding is a singleton?
But why do I see a database query every time I load the same page?
public class DomainPropertyService {
private Session session;
private ListDomain domains = null;
An: users@tapestry.apache.org
Betreff: Singleton Service behaves like a Per-Thread service
Hello everyone!
I am a bit confused. I thought the default service binding is a singleton?
But why do I see a database query every time I load the same page?
public class DomainPropertyService
Are you sure you're seeing a query or do you mean your code returns queries
the database ?
That method will always return queries the database.
I'm not sure what it's for but perhaps you would want to change it something
like
if (domains==null){
domains =
Not sure, but you're probably doing yourself a disservice by storing
state in a singleton. For instance, you have to guard against race
conditions and so forth. It's doable, but you might want to use a
transparent cache instead that does a lot of that sort of thing for
you, and then have
Hy Toby,
you might be fooled by your own code.
if (domains!=null){
return queries the database;
Should be
if (domains==null){
return queries the database;
Regards, nillehammer
--
http://www.winfonet.eu
superoverdr...@gmx.de schrieb:
Hello everyone!
I am a bit confused. I thought the default
christianedwardgru...@gmail.com
An: Tapestry users users@tapestry.apache.org
Betreff: Re: Singleton Service behaves like a Per-Thread service
Not sure, but you're probably doing yourself a disservice by storing
state in a singleton. For instance, you have to guard against race
conditions and so
:54 +0100
Von: nillehammer tapestry.nilleham...@winfonet.eu
An: Tapestry users users@tapestry.apache.org
Betreff: Re: Singleton Service behaves like a Per-Thread service
Hy Toby,
you might be fooled by your own code.
if (domains!=null){
return queries the database;
Should be
if (domains
Datum: Wed, 4 Feb 2009 16:40:47 -0500
Von: Christian Edward Gruber christianedwardgru...@gmail.com
An: Tapestry users users@tapestry.apache.org
Betreff: Re: Singleton Service behaves like a Per-Thread service
Not sure, but you're probably doing yourself a disservice by storing
state