On 7/2/10 2:20, Atle Prange wrote:
Hi,
i have a question about static references and how they are treated in OSGi.
Will singletons stay in memory after a bundle has been unloaded and
leak memory, or can i safely create huge amounts of static references?
And what about ThreadLocals? Can I use them safely as well? I see some
projecs use the "bundle activator singleton" pattern to access
resources throughout the code, but a tiny voice behind my ear tells me
that it might not be a good idea, is that voice right or wrong?
As long as a bundle cleans up its threads and other bundles do not hold
onto stale references (i.e., objects from bundles that have been
uninstalled), then there shouldn't be any issues. The framework doesn't
hold onto bundle objects or class loaders after they are uninstalled
(and refreshed).
-> richard
Thank you
-atle
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]