ActorRegistry and OSGI

43 views
Skip to first unread message

Mariusz

unread,
Jun 9, 2010, 6:26:51 AM6/9/10
to Akka User List
Question to OSGI and Akka experts:
Is it safe to use ActorRegistry in OSGi environment? I am afraid that
in osgi environment there will be many instances of ActorRegistry
because of many class loaders used to access ActorRegistry in
different bundles - is it possible? I don't know how scala handles
singleton objects in OSGi environment.

What solution is better to obtain actor: use ActorRegistry or publish
every actor as osgi service?

Mariusz

Heiko Seeberger

unread,
Jun 9, 2010, 9:45:33 AM6/9/10
to akka...@googlegroups.com
This is a good question, but I doubt we can answer it today, because the efforts to create OSGi support are not yet finished. First step is to provide bundles and second to investigate all the hidden pitfalls.

Heiko


--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.




--
Heiko Seeberger

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Stambecco, highly scalable computing: stambecco.org

Jonas Bonér

unread,
Jun 9, 2010, 9:58:53 AM6/9/10
to akka...@googlegroups.com

Right. All I can say now is that we have to and will solve it.

--
Jonas Bonér
http://jayway.com
http://akkasource.com
twitter: jboner

On 9 Jun 2010 15:45, "Heiko Seeberger" <heiko.s...@googlemail.com> wrote:

This is a good question, but I doubt we can answer it today, because the efforts to create OSGi support are not yet finished. First step is to provide bundles and second to investigate all the hidden pitfalls.

Heiko



On 9 June 2010 12:26, Mariusz <mariu...@gmail.com> wrote:
>

> Question to OSGI and Akka experts:...

--
Heiko Seeberger

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Stambecco, highly scalable computing: stambecco.org


--
You received this message because you are subscribed to the Google Groups "Akka User List" grou...

Roman Roelofsen

unread,
Jun 10, 2010, 5:20:21 PM6/10/10
to akka...@googlegroups.com
There shouldn't be a problem wrt OSGi. As long as you dont include
Akka in each of your bundles there will be one classloader for Akka
and therefore only one ActorRegistry.

However, how to apply the OSGi programming model (service registry,
...) is still open for discussion.

Cheers,

Roman

On 9 June 2010 12:26, Mariusz <mariu...@gmail.com> wrote:

> --

juyttenh

unread,
Jan 26, 2011, 9:13:42 AM1/26/11
to akka...@googlegroups.com
I've been thinking about this topic as well, as a novice akka user trying out akka in an OSGi environment.

Say I have a bundle containing 2 actors: actor A is intended to be used only internally by the bundle, and actor B would also be available to other bundles. If I understand this correct (and assuming that I don't include akka in each of my bundles) there would be just one ActorRegistry for the entire OSGi environment in which both actors are registered, and as such both would be available to other bundles as well.

I could instead publish only actor B as an OSGi service, and make all my bundles express dependencies using services. But still I can 't prevent any other bundle to directly lookup actor A from the registry, and this way get around my limited set of exported services. If I make actor B use strong-typed messages (case classes) or use a TypedActor and put these in non-exported packages, any other bundle would still be able to get the actor from the registry, but it would be rather useless as the messages it accepts are not available to this bundle. But still, being able to access an actor of another bundle would allow e.g. to stop this actor.

The ActorRegistry allows also to shutdown all actors. If I'd do this in the stop() method of a BundleActivator to shutdown a single bundle, all actors of all bundles would be shutdown. So that's a bit tricky, I guess I could instead accomplish this by using supervisors?

More in general, thinking in terms of modules and bundles it might be useful to have some sort of ActorRegistry for each bundle. Each bundle can decide to publish individual actors as services (or the registry as a whole if really needed).

Just my 2cts.

Anyone developed any opinions on this in the meantime?

Grtz,

Jan

√iktor Klang

unread,
Jan 26, 2011, 9:38:48 AM1/26/11
to akka...@googlegroups.com

How about classloader isolation for your different bundles and use remote actors to communicate between bundles?
 

Just my 2cts.

Anyone developed any opinions on this in the meantime?

Grtz,

Jan

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.



--
Viktor Klang,
Code Connoisseur
Work:   Scalable Solutions
Code:   github.com/viktorklang
Follow: twitter.com/viktorklang
Read:   klangism.tumblr.com

Robert Wills

unread,
Feb 3, 2011, 3:20:47 AM2/3/11
to akka...@googlegroups.com
Just came across this and thought of this thread. Would this be a
possible solution
(at least for Felix)?
http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html

The activator could then make sure that all activated bundles use the
same actor
registry.

I'll have a quick play with trying to get this to work if I get the chance.

-Rob

Jonas Bonér

unread,
Feb 3, 2011, 4:12:45 AM2/3/11
to akka...@googlegroups.com
On 3 February 2011 09:20, Robert Wills <wrw...@gmail.com> wrote:
> Just came across this and thought of this thread.  Would this be a
> possible solution
> (at least for Felix)?
> http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html
>
> The activator could then make sure that all activated bundles use the
> same actor
> registry.
>
> I'll have a quick play with trying to get this to work if I get the chance.

Great. Thanks. Please let us know what your conclusions are.

--
Jonas Bonér

Specialist at Large
work: http://scalablesolutions.se
code: http://akka.io
blog: http://jonasboner.com
twtr: @jboner

juyttenh

unread,
Feb 4, 2011, 4:39:05 AM2/4/11
to Akka User List
I'm not sure if I understand your post correctly, but IMHO it's not
really an issue that all activated bundles should use the same
registry. This is the case as long as you don't include Akka in each
of your bundles (as described earlier). It might become an issue if
you'd deploy two versions of Akka, e.g. when your bundles use
different versions of Akka.

I myself am looking for a way to actually have multiple registries,
one for each bundle. This way I could avoid bundles to access actors
they're not supposed to, as only the actors that are exported as OSGi
services are available to other bundles.

I'm still thinking about what Viktor suggested about classloader
isolation and remote actors. I guess this could indeed be a solution,
although I'm not sure it would be a desirable one. What would be the
impact (e.g. performance?) of using remote actors? This would required
a server (and port) for each bundle?

-Jan

--
Jan Uyttenhove / @xorto <twitter.com/xorto>
www.xume.com & blog.xume.com

On Feb 3, 9:20 am, Robert Wills <wrwi...@gmail.com> wrote:
> Just came across this and thought of this thread.  Would this be a
> possible solution
> (at least for Felix)?http://felix.apache.org/site/apache-felix-framework-launching-and-emb...
>
> The activator could then make sure that all activated bundles use the
> same actor
> registry.
>
> I'll have a quick play with trying to get this to work if I get the chance.
>
> -Rob
>
>
>
>
>
>
>
> On Wed, Jan 26, 2011 at 2:38 PM, √iktor Klang <viktor.kl...@gmail.com> wrote:

Akka Team

unread,
Feb 4, 2011, 5:38:22 AM2/4/11
to akka...@googlegroups.com
On Fri, Feb 4, 2011 at 10:39 AM, juyttenh <juyt...@gmail.com> wrote:
I'm not sure if I understand your post correctly, but IMHO it's not
really an issue that all activated bundles should use the same
registry. This is the case as long as you don't include Akka in each
of your bundles (as described earlier). It might become an issue if
you'd deploy two versions of Akka, e.g. when your bundles use
different versions of Akka.

I myself am looking for a way to actually have multiple registries,
one for each bundle. This way I could avoid bundles to access actors
they're not supposed to, as only the actors that are exported as OSGi
services are available to other bundles.

I'm still thinking about what Viktor suggested about classloader
isolation and remote actors. I guess this could indeed be a solution,
although I'm not sure it would be a desirable one. What would be the
impact (e.g. performance?) of using remote actors? This would required
a server (and port) for each bundle?

Yes. I'd recommend running one VM per app, for fault-tolerance reasons.
If you want to have one ActorRegistry per app, you either use classloader-isolation or run it in separate VMs.
Reply all
Reply to author
Forward
0 new messages