Scala singleton objects are implemented as a final java class with a static 
initializer that doesn't behave any differently under OSGi than a plain old 
java class with similar methods and initialization.

If I understand your concern, you're implying that singleton objects exist in a 
separate thread of some kind, with their own lifecycle, which may get orphaned 
when you unload a bundle. But, they don't, so it's not a problem. 

See [1] for a brief look inside scala singleton objects.

/Andreas

[1] 
http://pbadenski.blogspot.com/2009/06/design-patterns-in-scala-singleton.html

On Jul 31, 2010, at 4:58 PM, Atle Prange wrote:

> Hi,
> 
> i am about to embark on a journey involving scala and osgi. But it appears
> to me (ref. my last question on this list regarding static references) that
> it might not be a good idea, since the otion of scala objects actually are
> implemented as singletons, and therefor never will be cleaned up after a
> bundle is unloaded. Does anybody here have experience with scala on osgi,
> and could give me a hint on this matter?
> 
> -atle


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

Reply via email to