Hi to all

Recently I have this error during application run:

ERR;1447360171;1258130494;APPLICATION;Service.execute;03/06/2015 
09:37:37,271;ERROR Service: cannot create children while terminating or 
terminated
java.lang.IllegalStateException: cannot create children while terminating 
or terminated
    at akka.actor.dungeon.Children$class.makeChild(Children.scala:200)
    at akka.actor.dungeon.Children$class.attachChild(Children.scala:42)
    at akka.actor.ActorCell.attachChild(ActorCell.scala:369)
    at akka.actor.ActorSystemImpl.actorOf(ActorSystem.scala:552)
    
Generally happens after AskTimeoutException and after this error I have to 
restart application server.

Why (I never call shutdown actorSystem)? 

I try to solve the problem, but I dont know if this "patch" work correctly:

-----------------------------------------------------------------------------------------------------------------------------

Object result = null;

try{

...
    
    ActorRef masterActor = null;
        try{
            masterActor = 
myActorSystem.actorOf(SpringExtProvider.get(myActorSystem).props("MasterActor").withRouter(new
 
SmallestMailboxPool(4)), getMasterName(val1, val, val3));
        }
        catch(IllegalStateException ex){
            log.error("ACTOR SYSTEM IS TERMINATING: " + ex.getMessage());
            myActorSystem.awaitTermination();
            log.info("TRYING AGAIN...");
            try{
                masterActor = 
myActorSystem.actorOf(SpringExtProvider.get(myActorSystem).props("MasterActor").withRouter(new
 
SmallestMailboxPool(4)), getMasterName(val1, val, val3));
            }
            catch(IllegalStateException ex1){
                log.error("NOTHING TO DO: " + ex.getMessage());
                throw ex1;
            }
        }
    
    Future<Object> future = Patterns.ask(masterActor, inputMessage, 
timeout);
    result = Await.result(future, timeout.duration());
...

}
catch(RuntimeException e){
    e.printStackTrace();
    ...
}
catch(Exception e){
    e.printStackTrace();
    ...
}
    
return result;

-----------------------------------------------------------------------------------------------------------------------------

My application apply "PER REQUEST ACTOR" pattern 
(http://techblog.net-a-porter.com/2013/12/ask-tell-and-per-request-actors/)
http://techblog.net-a-porter.com/wp-content/uploads/2013/12/tell1.png
http://techblog.net-a-porter.com/wp-content/uploads/2013/12/tell2.png

masterActor == perRequest

I have only one ask method, at start point, to wait collection of actor's 
results to respond to my calling service.

Thanks to all!

-- 
>>>>>>>>>>      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