"If you create an extension you get an ExtendedActorSystem, which has a DynamicAccess, which lets you load classes dynamically.
Cheers,
V"
Extensions: http://doc.akka.io/docs/akka/2.0.3/scala/extending-akka.html
"
ClassLoader wrapper which is used for reflective accesses internally. This is set to use the context class loader, if one is set, or the class loader which loaded the ActorSystem implementation. The context class loader is also set on all threads created by the ActorSystem, if one was set during
creation.
"
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
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.
Visit this group at http://groups.google.com/group/akka-user?hl=en.
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
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.
Visit this group at http://groups.google.com/group/akka-user?hl=en.
Almost, I have created the extension and, in my implementation, I can get ahold of the DynamicAccess reference. However, I should be able to use that interface to do something like:dynamicRef.getClassFor(className)
However, the compiler (java 1.5) complains the interface won't allow it.
Akka requires that you have Java 1.6 or later installed on you machine.
On Saturday, October 13, 2012 8:35:50 PM UTC-7, John Antypas wrote:Many thanks to those who helped -- I'm getting closer. I'd like to dynamically load a class to create an Actor.For a given actor system, I could use the ActorOf and in the props, get the class. However, that requires I know the default class loader for that actor system.I'd then be able to do something like this pseudo-codemodules : List[String]foreach (item : modules) {Class classz = Class.loadClass(item)ActorRef ref = actorsytem.create(classz)ref.tell("start")}But the question is, for the newly created ActorSystem, how do I get its default class loader to use it? Or, is there some method in ActorSystem to load a class by string name rather than class reference?
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
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.
Visit this group at http://groups.google.com/group/akka-user?hl=en.