@Patrik, I guess you're right. I have looked at the code, and while this action is blocking, the code underneath just creates a few actors which is non-blocking. So I guess this would be really fast and there would be no gain in putting a lot of effort to make this non-blocking.
@Roland Does that mean the actorOf() will then no longer return a plain ActorRef, but maybe some future or a message after initialization? That would make it harder to use and reason about, doesn't it? I guess you are taking that into consideration. Is there any information about Akka Gålbma? Op zaterdag 10 mei 2014 12:41:18 UTC+2 schreef Akka Team: > > Returning a strict result immediately and performing the work > asynchronously are fundamentally at odds with each other, which is why I > consider it a minor miracle that system.actorOf() could be made to work—but > it still is the biggest mistake that I made in evolving Akka considering > all the pain it inflicts on the implementation and its maintainers. Akka > Gålbma will not have this feature. > > Regards, > > Roland > > > > On Fri, May 9, 2014 at 7:33 PM, Heiko Seeberger > <[email protected]<javascript:> > > wrote: > >> Maybe we could have `start` return an `ActorRef` immediately, i.e. an >> asynchronous operation like `actorOf`? >> >> Heiko >> >> >> >> On Fri, May 9, 2014 at 4:48 PM, Patrik Nordwall >> <[email protected]<javascript:> >> > wrote: >> >>> >>> >>> >>> On Fri, May 9, 2014 at 4:43 PM, Jeroen Gordijn >>> <[email protected]<javascript:> >>> > wrote: >>> >>>> Thanks Patrik, I overlooked that it is blocking, that makes the fix >>>> even easier. You mention that you would not do it in the same place and I >>>> don't have enough experience to comment on that, but in the course it >>>> seemed perfectly valid to do just that. I created a ticket: >>>> https://github.com/akka/akka/issues/15157 >>>> >>> >>> Thanks, yes, on second thought I agree. Pass it in to other actors. >>> /Patrik >>> >>> >>>> >>>> Cheers, >>>> Jeroen >>>> >>>> Op vrijdag 9 mei 2014 16:33:07 UTC+2 schreef Patrik Nordwall: >>>>> >>>>> You should be able to do those calls immediately after each other, >>>>> from same thread. >>>>> ClusterSharding(context.system).start >>>>> ClusterSharding(context.system).shardRegion >>>>> >>>>> Start doesn't return until it has been initalized. >>>>> >>>>> Normally, I don't think these two things are done at the same place in >>>>> the code, so I don't think it is much value in returning the ActorRef >>>>> from >>>>> start, but it would not hurt to do so. Please create a >>>>> ticket<https://github.com/akka/akka/issues>. >>>>> Thanks for reporting. >>>>> >>>>> Cheers, >>>>> Patrik >>>>> >>>>> >>>>> On Fri, May 9, 2014 at 3:48 PM, Jeroen Gordijn >>>>> <[email protected]>wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> I followed the Advanced akka course in the last 2 days (which was >>>>>> awesome by the way) and noticed something of the API which I think can >>>>>> be >>>>>> improved. When you start the ClusterSharding its return type is Unit and >>>>>> you have to retrieve the ShardRegion by calling the "shardRegion" on >>>>>> ClusterSharding. However, this cannot take place in a short period, >>>>>> because >>>>>> "shardRegion(...)" will 'throw new IllegalArgumentException(s"Shard >>>>>> type [$typeName] must be started first")'. >>>>>> >>>>>> In my mind it would be an improvement if the start returns an >>>>>> ActorRef immediately and then buffers all requests to it until the >>>>>> ShardRegion is initialized. Am I overlooking some problems with that? >>>>>> >>>>>> Cheers, >>>>>> Jeroen >>>>>> >>>>>> -- Start ShardRegion >>>>>> ClusterSharding(context.system).start( >>>>>> "player", >>>>>> Some(Player.props), >>>>>> Player.idExtractor, >>>>>> Player.shardResolver(10) >>>>>> ) >>>>>> >>>>>> -- get reference to ShardRegion >>>>>> val playerRegion = ClusterSharding(context. >>>>>> system).shardRegion("player") >>>>>> >>>>>> -- >>>>>> >>>>>>>>>> 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. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> >>>>> Patrik Nordwall >>>>> Typesafe <http://typesafe.com/> - Reactive apps on the JVM >>>>> Twitter: @patriknw >>>>> JOIN US. REGISTER TODAY! <http://www.scaladays.org/> >>>>> Scala <http://www.scaladays.org/> >>>>> Days <http://www.scaladays.org/> >>>>> June 16th-18th, <http://www.scaladays.org/> >>>>> Berlin <http://www.scaladays.org/> >>>>> >>>>> -- >>>> >>>>>>>>>> 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. >>>> >>> >>> >>> >>> -- >>> >>> Patrik Nordwall >>> Typesafe <http://typesafe.com/> - Reactive apps on the JVM >>> Twitter: @patriknw >>> JOIN US. REGISTER TODAY! <http://www.scaladays.org/> >>> Scala <http://www.scaladays.org/> >>> Days <http://www.scaladays.org/> >>> June 16th-18th, <http://www.scaladays.org/> >>> Berlin <http://www.scaladays.org/> >>> >>> -- >>> >>>>>>>>>> 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. >>> >> >> >> >> -- >> >> Heiko Seeberger >> Twitter: @hseeberger >> Blog: blog.heikoseeberger.name >> >> -- >> >>>>>>>>>> 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]. 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.
