On Wednesday, August 27, 2014 5:34:02 PM UTC+2, rkuhn wrote:
>
> There is another possibility (if needed):
>
> system.dispatchers.registerConfigurator(name, ...)
>

Thanks for this hint. Looks interesting indeed. Unfortunately this seems to 
be an akka 2.3.x feature and we are still using akka 2.2 (which I forgot to 
mention). I guess with this I could do something crazy like registering a 
configurator per user and then refer to this when "starting" the actor. Not 
sure if it is meant to be used like this, though :-)
 

>
> can be used to register a dispatcher factory that you can fully control. 
> The Actors will still need to use the right name in order to access it, and 
> this decision is deliberate so that Props has a decent chance of being 
> serializable (to be sent across the network for remote deployment).
>

I see your point about the Props. Maybe I am just trying to abuse this 
feature of configurable dispatchers ... :-)

Anyways thanks a lot for the help
Volker
 

>
> Regards,
>
> Roland
>
> 27 aug 2014 kl. 14:34 skrev Akka Team <[email protected] <javascript:>>:
>
> Hi Volker,
>
> Do you really need to create that dispatcher dynamically? You can create a 
> custom static one that has dynamic behavior, basically just calling 
> UserGroup... and PrivilegedAction. I mean, I don't really see why the 
> dispatcher itself must be created dynamically, only its behavior needs to 
> access these methods.
>
> -Endre
>
>
> On Tue, Aug 26, 2014 at 11:23 AM, <[email protected] <javascript:>> 
> wrote:
>
>> Hi,
>>
>> is it possible to start an actor with a dynamically created dispatcher? I 
>> know that a dispatcher can be configured 
>> <http://doc.akka.io/docs/akka/snapshot/scala/dispatchers.html#Setting_the_dispatcher_for_an_Actor>
>>  per 
>> actor, however this dispatcher is created and configured statically. I 
>> rather look for something like:
>>
>> def createExecutorService(localContext: ...): ExecutorService = ...
>> val localContext = ...
>> context.actorOf(someProps.withDispatcher(createExecutorService(
>> localContext)))
>>
>> The use-case is using secure impersonation when interacting with hadoop. 
>> When interacting with hadoop I dynamically create an actor (that internally 
>> spawns Futures on its dispatcher). For secure impersonation each code 
>> section that interacts with hadoop has to be wrapped in something like:
>>
>> UserGroupInformation.createProxyUser(userName, UserGroupInformation.
>> getLoginUser).doAs {
>>   new PrivilegedAction[A] {
>>     def run() = { ... }
>>   }
>> }
>>
>> To avoid spreading this over the actor's code a dynamically created 
>> dispatcher could help (in this case the userName is the localContext). 
>> If that is configured with a ThreadFactory like this:
>>
>> val tf: ThreadFactory = _
>> new ThreadFactory {
>>   override def newThread(r: Runnable) = {
>>     tf.newThread(new Runnable {
>>       override def run() = {
>>         UserGroupInformation.createProxyUser(userName, 
>> UserGroupInformation.getLoginUser).doAs(new PrivilegedAction[Unit] {
>>           override def run() = r.run()
>>         })
>>       }
>>     })
>>   }
>> }
>>
>> all code executed by the actor (and its spawned Futures) would 
>> automatically be executed on behalf of a given hadoop-user.
>>
>> Thanks for any help/hints/pointers,
>> Volker
>>
>>
>> -- 
>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>> >>>>>>>>>> Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>> >>>>>>>>>> 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 unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Akka Team
> Typesafe - The software stack for applications that scale
> Blog: letitcrash.com
> Twitter: @akkateam
>
> -- 
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: 
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> 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 unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected] 
> <javascript:>.
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> *Dr. Roland Kuhn*
> *Akka Tech Lead*
> Typesafe <http://typesafe.com/> – Reactive apps on the JVM.
> twitter: @rolandkuhn
> <http://twitter.com/#!/rolandkuhn>
>  
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to