On 7/2/10 9:06, Richard S. Hall wrote:
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).

Of course, I should have added, I don't recommend using statics, since they are just another form of global variables.

-> richard


-> richard

Thank you

-atle

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to