[Seaside] Single or multiple instances of application top-level class?

Richard E. Flower rickf at ca-flower.com
Thu Jan 1 20:28:37 UTC 2009


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

> 2009/1/1, Richard E. Flower <rickf at ca-flower.com>:
>> On Jan 1, 2009, at 11:32 AM, Philippe Marschall wrote:
>>
>>> 2009/1/1, Richard E. Flower <rickf at ca-flower.com>:
>>>> 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



More information about the seaside mailing list