Schaible, J�rg wrote:
Hi Steve,
From: Stephen McConnell [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 1:35 PM
Not necessarily - the service method is simply the point at which the ServiceManager is supplied to the component. The component implementation can choose to access services at this point, or, cache the reference and access the services it needs when and if it needs them. Both Fortress and Merlin provide support for delayed activation of a service which basically means that although you have been supplied with a manager, the services the manager will provide on lookup may not be instantiated (for example, the instantiation may be trigger by the lookup request).
OK, I will have such a delayed activation. The reason is to have a factory based on credentials. A lookup for the factory with an unknown credential should result in a new factory instance, that lives for some time after the last performed lookup. It seems that I will need a separate configuration file for these factories ...
And what about the release call? Should not every retrieved element
be released again?
In principal - yes.
While the DefaultServiceManager does nothing, the actual ServiceManager implementations should be dealing with the released component relative to the lifestyle policy that the component implements. For example, the Merlin implementation of ServiceManager delegates release requests back to the hosting appliance which has a reference to the lifecycle handler. This enables different policies such as direct disposal, disposal relative to reference counting, returning an object to a pool, etc.
By being strict about the release of components you make it possible for the component implementation lifestyle strategy to be changed. It could initially created as a transient object (new instance per request and disposal on release) and migrate to a pooled of thread-safe singleton. By respecting the release contract you client code can remain totally agnostic relative to the lifestyle policy of the component providing a particular service.
At least the code of FortressServiceManager.relase
seems to expect this, while framework's DefaultServiceManager does not
care at all. So it comes down to "release always, until you exactly know
that is does not matter for the service".
And generally speaking - its better not to know.
Cheers, Steve.
Regards, J�rg
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
Stephen J. McConnell mailto:[EMAIL PROTECTED] http://www.osm.net
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
