Re: C# ServicedComponent Singleton

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Willy Denoyette [MVP] (willy.denoyette_at_pandora.be)
Date: 12/08/04


Date: Wed, 8 Dec 2004 21:07:27 +0100


"David Browne" <davidbaxterbrowne no potted meat@hotmail.com> wrote in
message news:uLDIgaV3EHA.3908@TK2MSFTNGP12.phx.gbl...
>
> "David" <nospam@sympatico.ca> wrote in message
> news:Ox6G6JV3EHA.3452@TK2MSFTNGP14.phx.gbl...
>> What do you mean by serialized singleton?
>
> If you have two different threads, or two different processes trying to
> access the object, they will be serialized. One will wait until the other
> has released the reference to the object. Not just the method calls will
> be serialized, but whole sequence of client code using the object
>
> obj = CreateObject(...)
> obj.MethodA
> obj.MethodB
> set obj = null
>
> will be strictly serialized. A second thread or process will block on
> CreateObject until the previous thread has released the reference with set
> obj=null.

This is not exactly true, that's the purpose of the JITA mechanism and
ContextUtil.SetComplete (or [AutoComplete(true)]), as soon as a method ends
the object returns to the pool where it waits to be re-activated.
Any number of clients (subject to scalability) can CREATE and KEEP a
reference a COM+ singleton object.
Each client creation call will get a reference to the same instance provided
no single client is currently executing a method, when that's the case the
activation request will be suspended for a max. of the configured
"activation time-out".
Method calls are automatically synchronized (implied by JITA), each method
call will be suspended (activation time-out) whenever another client is
executing a method.

Willy.



Relevant Pages

  • Re: How to I access a logging class from any other class.
    ... where the Client is instantiating the R2 object when it passes a reference to Service2 to Service1. ... participation in the R2 relationship is a personal matter between and [Service2]. ... But for Client to pass the /right/ instance of, the Client must understand the rules and policies related to defining participation in the R2 relationship. ... Singleton essentially disguises the notion of a global instance as a local implementation instance. ...
    (comp.object)
  • COM component event interaction question
    ... remoted reference to the singleton COM object. ... works except for events on the client. ... // Brokerage Reference ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: Singletons
    ... Such attributes are usually initialized by the constructor or a factory object when the object in hand is created. ... There are actually two objects involved in Singleton. ... To access that method there must already be a relationship that can be navigated by the client to get to the Singleton object to invoke GetInstance. ... When Singleton passes back the reference to Client it is temporarily instantiating the R3 relationship between Client and the Collaborator that Client navigates when it talks to Collaborator. ...
    (comp.object)
  • Re: Searching OO Associations with RDBMS Persistence Models
    ... and the Client needs access to locations for a particular Company. ... In this case I would argue that it should be a reference. ... There are three aspects to relationships: implementation, instantiation, and navigation. ... This sort of instantiation is ubiquitous in OO applications so that one very rarely ever sees a FIND WHERE construct. ...
    (comp.object)
  • Re: Singletons
    ... By modifying the context I meant that one defines the solution flow of control differently so that the instantiation can be done in one place rather than in several. ... Singleton is really just a specialized factory object. ... There is no way for the client to know whether the instance returned is one of one or one of many. ... Because many network protocols limit the size of the message so it has to be split up into separate packets. ...
    (comp.object)