Hi,

I thought I should add this. Basically this works when my TestActor is at 
the system level, i.e. system.actorOf. However what I am trying to do is to 
stop an actor *which is a child of another*. 

Thanks,
B

On Wednesday, April 16, 2014 1:55:59 PM UTC+8, Boney Sekh wrote:
>
> Hi,
>
> I have been trying to use the Patterns.gracefulStop to stop an actor 
> gracefully. I know my internal actor is stopped by verifying the postStop 
> method is invoked.
> However, the future is not returning true and is held until timeout.
>
> Is there a bug?
>
> Here is my code:
>
> public class TestActor extends UntypedActor {
>
>     private final Logger log = LoggerFactory.getLogger(TestActor.class);
>
>     final ActorRef target;
>
>     public TestActor( ActorRef target ) {
>         this.target = target;
>     }
>
>     @Override
>     public void postStop() throws Exception {
>         super.postStop();
>         log.info("Actor stopped...");
>     }
>
>     @Override
>     public void onReceive( Object msg ) {
>         if ( msg == Command.STOP_PROCESSING ) {
>             log.info("Stopping actor...");
>             getContext().stop( getSelf() );
>         } else {
>             unhandled(msg);
>         }
>     }
>
> }
>
> Code to stop:
>
> Future< Boolean > stopped = Patterns.gracefulStop( actorRef, 
> Duration.create( 5, TimeUnit.SECONDS ), Command.STOP_PROCESSING );
> Await.result( stopped, Duration.Inf() );
>

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
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