Frank Schönheit - Sun Microsystems Germany wrote:
Hi Stephan,
[...]
(Caching might for example be done across
multiple service instances, or a service implementation might behave as
a singleton, by always returning the same instance for createInstance.
"What do we need singletons for in UNO, then?" you might ask. "Well, I
have no idea" I would confess.)
Hmm, if we see it this way ....
As far as I understood, the latter way (behave as singleton, return the
same instance in every createInstance call) was considered Bad (TM)
since the singleton-nature then is non-obvious.
Right, and the example posted by Jörg is indeed convincing of why we
should have both concepts, services and singletons.
Caching across multiple instances sounds confusing, too. This is a
pretty fuzzy, hmm, gut feeling only, but I wouldn't want to get the same
resource bundle instance from different loader instance.
Of course, whether caching across instances is good depends on the
nature of what is cached, on how the caching influences the observable
interface of your service.
-Stephan
Finnaly, for me it boils down to: Declaring a service as singleton is
just some conceptual flavor for documentation purpose. You only need one
process-wide resource loader, that's what is stated with the "singleton"
attribute.
[...]
Ciao
Frank
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]