From 2925f1eb997e3d871ba660ad0c7087f002b497c9 Mon Sep 17 00:00:00 2001 From: Roland Kuhn Date: Wed, 9 Mar 2016 22:30:08 +0100 Subject: [PATCH] add FAQ entry for careful ActorSystem creation, #15313 --- akka-docs/rst/additional/faq.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/akka-docs/rst/additional/faq.rst b/akka-docs/rst/additional/faq.rst index bbc339bdda..089ea42d59 100644 --- a/akka-docs/rst/additional/faq.rst +++ b/akka-docs/rst/additional/faq.rst @@ -25,6 +25,18 @@ Akka is also: * a town in Morocco * a near-earth asteroid +Resources with Explicit Lifecycle +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Actors, ActorSystems, ActorMaterializers (for streams), all these types of objects bind +resources that must be released explicitly. The reason is that Actors are meant to have +a life of their own, existing independently of whether messages are currently en route +to them. Therefore you should always make sure that for every creation of such an object +you have a matching ``stop``, ``terminate``, or ``shutdown`` call implemented. + +In particular you typically want to bind such values to immutable references, i.e. +``final ActorSystem system`` in Java or ``val system: ActorSystem`` in Scala. + Actors in General ^^^^^^^^^^^^^^^^^