Hi Konrad, Thanks for reply. More inlined. W dniu wtorek, 27 stycznia 2015 11:01:58 UTC+1 użytkownik Konrad Malawski napisał: > > Please do not ever rely on java finalization – ever. > > For one thing, it's unreliable – no-one guarantees that these will ever be > called. [60] > <https://github.com/arkadius/akka-simple/blob/master/src/main/scala/akka/actor/simple/SimpleActor.scala#L60> > Also, just by having a finalizer defined you put a way larger burden on > the collector as it has to track those in a similar way it does with > java.lang.ref.* references (putting in reference queues etc instead of just > reclaiming space). > It's true. In fact this finalize behaviour was only a hint for Actor. I could provide other way to clenup internal actors for example repeated job checking if SimpleActor was released. And also it is in't a core thing for this implementation to cleanup an internal Actor. Core memory part will be declared in SimpleActors which will be normally cleaned up by jvm.
> You should never block in your Actors when working with Akka. Remember the > "never block" mantra :-) > Calling Await inside actor code is a big "no-no" – this will cause your > entire application (everyone on that dispatcher) to suffer for it. [36] > <https://github.com/arkadius/akka-simple/blob/master/src/main/scala/akka/actor/simple/SimpleActor.scala#L36> > Please refer to the documentation about actor systems > <http://doc.akka.io/docs/akka/snapshot/general/actor-systems.html#actor-best-practices> > > to read more about this. > Yes, I know this. Shortcut for Await was only added for purpose of quicker Actor tests and it is minor think. I know that the best is to keep your code as much async as it possible. But I think that it could be helpful to just check how Actor will reply on request without using additional tools like Await. > In general I would not recommend wrapping Akka in such way and simply > embracing the asynchronous nature of it. > You'll get better performance and fully-embracing these concepts instead > of hiding it here and there will get you to cleaner code by the end of the > day too. > Ok, but what do you think about shortcut for creating Actors by new operator with auto-gc? I don't think about it as a subistitution but just like a nice addition :-) I think that in many cases people use akka actors for small applications that will be never used in cluster. For this simple use case it is a little inconvenience to declare ActorSystem, provide specialized ExecutionContext depend on situation, and keep thinking if actors memory was released. I know background of all this things but tools should be selected depend on situation :-) Cheers, Arek -- >>>>>>>>>> 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.
