@CallerSideMethod protected void __stopImpl() { Log.Debug(this,"stopping actor "+getClass().getSimpleName()); Actor self = __self; if ( self == null || getActor() == null || (self.isStopped() && getActor().isStopped()) ) return; getActorRef().__stopped = true; getActor().__stopped = true; if (__stopHandlers!=null) { __stopHandlers.forEach( (cb) -> cb.complete(self(), null) ); __stopHandlers.clear(); } // remove ref to real actor as ref might still be referenced in threadlocals and // queues. //FIXME: this causes NPE instead of deadletter // try { // getActorRef().getClass().getField("__target").set( getActorRef(), null ); // } catch (IllegalAccessException e) { // e.printStackTrace(); // } catch (NoSuchFieldException e) { // e.printStackTrace(); // } throw InternalActorStoppedException.Instance; }
@Local public void cyclic(long interval, Callable<Boolean> toRun) { if ( ! isStopped() ) { Boolean res = true; try { res = toRun.call(); } catch (Exception e) { Log.Warn(this,e); } if (res) self().delayed(interval,() -> cyclic(interval,toRun) ); } }
@Local public void cyclic(long interval, Callable<Boolean> toRun) { if ( ! isStopped() ) { Boolean res = true; try { res = toRun.call(); } catch (Exception e) { Log.Warn(this,e); } if (res) self().delayed(interval,() -> cyclic(interval,toRun) ); } }
@CallerSideMethod protected void __stopImpl() { Log.Debug(this,"stopping actor "+getClass().getSimpleName()); Actor self = __self; if ( self == null || getActor() == null || (self.isStopped() && getActor().isStopped()) ) return; getActorRef().__stopped = true; getActor().__stopped = true; if (__stopHandlers!=null) { __stopHandlers.forEach( (cb) -> cb.complete(self(), null) ); __stopHandlers.clear(); } // remove ref to real actor as ref might still be referenced in threadlocals and // queues. //FIXME: this causes NPE instead of deadletter // try { // getActorRef().getClass().getField("__target").set( getActorRef(), null ); // } catch (IllegalAccessException e) { // e.printStackTrace(); // } catch (NoSuchFieldException e) { // e.printStackTrace(); // } throw InternalActorStoppedException.Instance; }
/** * avoids exception when closing an actor after stop has been called. */ @CallerSideMethod public void stopSafeClose() { if ( isStopped() ) { getActor().close(); // is threadsafe } else { self().close(); } }
/** * avoids exception when closing an actor after stop has been called. */ @CallerSideMethod public void stopSafeClose() { if ( isStopped() ) { getActor().close(); // is threadsafe } else { self().close(); } }
if ( publishedActor != null && ! publishedActor.isStopped() && publishedActor.isPublished() ) { System.out.println("unpublishing " + zzLastLiveActorId + " " + publishedActor); connectionRegistry.unpublishActor(publishedActor);
if ( publishedActor != null && ! publishedActor.isStopped() && publishedActor.isPublished() ) { System.out.println("unpublishing " + zzLastLiveActorId + " " + publishedActor); connectionRegistry.unpublishActor(publishedActor);
if ( ud.lastRoutedService != null ) { boolean published = ud.lastRoutedService.isPublished(); boolean stopped = ud.lastRoutedService.isStopped(); if (!stopped) { forwardCall(rce, ud.lastRoutedService, clientRemoteRegistry);
if ( ud.lastRoutedService != null ) { boolean published = ud.lastRoutedService.isPublished(); boolean stopped = ud.lastRoutedService.isStopped(); if (!stopped) { forwardCall(rce, ud.lastRoutedService, clientRemoteRegistry);