Single or multiple instances of application top-level class?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Single or multiple instances of application top-level class?

Rick Flower
Up to now, I've been assuming that the top-level application class had  
its own instance per connection.. Is my assumption correct or is this  
a singleton class? I just want to make sure my current thinking is  
correct.. Thanks!

-- Rick

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Single or multiple instances of application top-level class?

Philippe Marschall
2009/1/1, Richard E. Flower <[hidden email]>:
> Up to now, I've been assuming that the top-level application class had
> its own instance per connection.. Is my assumption correct or is this
> a singleton class?

Assuming we're talking about WAApplication it is one instance per URL.
This instance in concurrently accessed.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Single or multiple instances of application top-level class?

Rick Flower
On Jan 1, 2009, at 11:32 AM, Philippe Marschall wrote:

> 2009/1/1, Richard E. Flower <[hidden email]>:
>> Up to now, I've been assuming that the top-level application class  
>> had
>> its own instance per connection.. Is my assumption correct or is this
>> a singleton class?
>
> Assuming we're talking about WAApplication it is one instance per URL.
> This instance in concurrently accessed.

Thanks for the reply.. Just a few more questions.. I went and checked  
my main top-level class and its
derived from WAComponent and not WAApplication.. This code was  
originally developed in Seaside
2.5 and moved forward to version 2.8 now.. Should I instead be using  
WAApplication?

Also, when you mention one instance per URL, can I equate that to be  
one per Seaside application
or can it be associated with connections?  Your wording above sounds  
like its one per Seaside application,
but I wanted to double-check.. Currently my code assumes its one  
instance per connection and has
a 'content' object.. I want to ensure that IF this is a singleton then  
I need to refactor things a bit to ensure
this 'content' object moves elsewhere..

Thanks!



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Single or multiple instances of application top-level class?

Philippe Marschall
2009/1/1, Richard E. Flower <[hidden email]>:

> On Jan 1, 2009, at 11:32 AM, Philippe Marschall wrote:
>
>> 2009/1/1, Richard E. Flower <[hidden email]>:
>>> Up to now, I've been assuming that the top-level application class
>>> had
>>> its own instance per connection.. Is my assumption correct or is this
>>> a singleton class?
>>
>> Assuming we're talking about WAApplication it is one instance per URL.
>> This instance in concurrently accessed.
>
> Thanks for the reply.. Just a few more questions.. I went and checked
> my main top-level class and its
> derived from WAComponent and not WAApplication.. This code was
> originally developed in Seaside
> 2.5 and moved forward to version 2.8 now.. Should I instead be using
> WAApplication?

Depends on what your problem is. However there rarely should be any
need write your own WAApplication class.

> Also, when you mention one instance per URL, can I equate that to be
> one per Seaside application

Yes, WAApplication is the seaside application you find at a particular
URL. There is only one for a given URL.

> or can it be associated with connections?  Your wording above sounds
> like its one per Seaside application,
> but I wanted to double-check.. Currently my code assumes its one
> instance per connection and has
> a 'content' object.. I want to ensure that IF this is a singleton then

There are only very few singletons in Seaside (because they suck) and
they don't include WAApplication or WAComponent. The root component
class is instantiated when a new session is created and bound to this
session. From there other instances of WAComponent are created on
demand and bound to the root component instance.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Single or multiple instances of application top-level class?

Rick Flower
On Jan 1, 2009, at 12:19 PM, Philippe Marschall wrote:

> 2009/1/1, Richard E. Flower <[hidden email]>:
>> On Jan 1, 2009, at 11:32 AM, Philippe Marschall wrote:
>>
>>> 2009/1/1, Richard E. Flower <[hidden email]>:
>>>> Up to now, I've been assuming that the top-level application class
>>>> had
>>>> its own instance per connection.. Is my assumption correct or is  
>>>> this
>>>> a singleton class?
>>>
>>> Assuming we're talking about WAApplication it is one instance per  
>>> URL.
>>> This instance in concurrently accessed.
>>
>> Thanks for the reply.. Just a few more questions.. I went and checked
>> my main top-level class and its
>> derived from WAComponent and not WAApplication.. This code was
>> originally developed in Seaside
>> 2.5 and moved forward to version 2.8 now.. Should I instead be using
>> WAApplication?
>
> Depends on what your problem is. However there rarely should be any
> need write your own WAApplication class.

Ok.. I'll stick with my main component residing as a WAComponent for  
now.

>> Also, when you mention one instance per URL, can I equate that to be
>> one per Seaside application
>
> Yes, WAApplication is the seaside application you find at a particular
> URL. There is only one for a given URL.
>
>> or can it be associated with connections?  Your wording above sounds
>> like its one per Seaside application,
>> but I wanted to double-check.. Currently my code assumes its one
>> instance per connection and has
>> a 'content' object.. I want to ensure that IF this is a singleton  
>> then
>
> There are only very few singletons in Seaside (because they suck) and
> they don't include WAApplication or WAComponent. The root component
> class is instantiated when a new session is created and bound to this
> session. From there other instances of WAComponent are created on
> demand and bound to the root component instance.

Good enough.. My assumption works OK then.. This is enough info to
allow me to continue refactoring a bit.. Thanks again!

-- Rick

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside