warning: MThreaded
@param actor
508338
protected void remoteRefStopped(Actor actor) {
        removeRemoteActor(actor);
        actor.getActorRef().__stopped = true;
        actor.getActor().__stopped = true;
    }
723853
@SuppressWarnings("unchecked")
    public boolean execute(Runnable r) {
    	
    	try {
			queue[queue_no++ % nThreads].putFirst(r);
			if (queue_no == nThreads){
				queue_no = 0;
			}
            return true;
		} catch (InterruptedException e) {
            String info = "Failed to enqueue task: ";
            Throwable baseCause = org.gautelis.vopn.lang.Stacktrace.getBaseCause(e);
            info += baseCause.getMessage();
            log.warn(info, e);
		}
        return false;
    }
229890
@SuppressWarnings("unchecked")
  public void distributedProcess(ResponseBuilder rb, ComponentFields mtasFields)
      throws IOException {
    // rewrite
    NamedList<Object> mtasResponse = null;
    try {
      mtasResponse = (NamedList<Object>) rb.rsp.getValues().get("mtas");
    } catch (ClassCastException e) {
      log.debug(e);
      mtasResponse = null;
    }
    if (mtasResponse != null) {
      ArrayList<Object> mtasResponseGroup;
      try {
        mtasResponseGroup = (ArrayList<Object>) mtasResponse.get(NAME);
        if (mtasResponseGroup != null) {
          MtasSolrResultUtil.rewrite(mtasResponseGroup, searchComponent);
        }
      } catch (ClassCastException e) {
        log.debug(e);
        mtasResponse.remove(NAME);
      }
    }
  }
509130
private Object execute(Class<?> service, Object actor, RequestDTO requestDTO) {
        return invoke(service, actor, requestDTO.getMethod(), requestDTO.getParamterTypes(),
                requestDTO.getParameters(), requestDTO.getAppId(), requestDTO.getToken());
    }
1030156
@Override
  public void invoke(InboxAmp mailbox, StubAmp actorDeliver)
  {
    // actorDeliver.queryError(_headers, _from, _qid, _exn);
    
    StubAmp actorMessage = _serviceRef.stub();
    
    // kraken/210a vs baratine/2245
    StubAmp actorInvoke = actorDeliver.worker(actorMessage);
    
    // actorInvoke.queryError(_headers, actorMessage, _qid, _exn);
    actorInvoke.queryError(_headers, _from, _qid, _exn);
  }
1219822
public void schedulePendingAdds() {
        ArrayList<Actor> newOnes = new ArrayList<>();
        Actor a;
        while ( (a=toAdd.poll()) != null ) {
            newOnes.add(a);
        }
        if ( newOnes.size() > 0 ) {
            Actor newQueue[] = new Actor[newOnes.size()+actors.length];
            System.arraycopy(actors,0,newQueue,0,actors.length);
            for (int i = 0; i < newOnes.size(); i++) {
                Actor actor = newOnes.get(i);
                newQueue[actors.length+i] = actor;
            }
            actors = newQueue;
        }

    }
1027615
@Override
  public void invoke(InboxAmp inbox, StubAmp actor)
  {
    Thread thread = Thread.currentThread();
    ClassLoader oldLoader = thread.getContextClassLoader();
    
    try {
      thread.setContextClassLoader(_loader);
      
      getDelegate().invoke(inbox, actor);
    } finally {
      thread.setContextClassLoader(oldLoader);
    }
  }
634749
@Deprecated
    static <T> Consumer<T> indexeed(final IndexedConsumer<T> action) {
        return Consumers.indexed(action);
    }
414184
function Sweep(actor, context) {
  this.actor = actor;
  this.context = context;
  this.prev = context.actors[actor] || {};
  this.resources = context.actors[actor] = {};
}
815549
private void resetSyncToOSThread(WebSecurityContext webSecurityContext) throws ThreadIdentityException {
        Object token = webSecurityContext.getSyncToOSThreadToken();
        if (token != null) {
            ThreadIdentityManager.resetChecked(token);
        }
    }
704118
def do(actor, targets)
    targets.each do |target|
      target.environment.remove_object(target.identifier)
    end
  end
593968
public static <T extends Actor> T AsActor(Class<T> actorClazz, Scheduler scheduler, int qsize) {
        return (T) instance.newProxy(actorClazz,scheduler,qsize);
    }
1249325
def check_actors(self, actors):
        
        super(Flow, self).check_actors(actors)
        actor = self.first_active
        if (actor is not None) and not base.is_source(actor):
            raise Exception("First active actor is not a source: " + actor.full_name)
403515
private static void tryWaitingForGC() {
    // We could try to preallocate memory mx bean and count collections...
    // there is no guarantee it doesn't allocate stuff too though.
    final long timeout = System.currentTimeMillis() + 2000;
    while (System.currentTimeMillis() < timeout) {
      System.gc(); 
      try {
        Thread.sleep(250);
      } catch (InterruptedException e) {
        break;
      }
    }
  }
28496
public void addDispatcher(String dispatcherId, int threadsCount) {
        synchronized (dispatchers) {
            if (dispatchers.containsKey(dispatcherId)) {
                return;
            }

            ActorDispatcher dispatcher = new ActorDispatcher(dispatcherId, ThreadPriority.LOW, this,
                    Runtime.isSingleThread() ? 1 : threadsCount);

            dispatchers.put(dispatcherId, dispatcher);
        }
    }
1251199
public void mutableSubtract(double c, Matrix B, ExecutorService threadPool)
    {
        mutableAdd(-c, B, threadPool);
    }
733578
public static void setKeyboardFocus(final Actor actor) {
        if (actor != null && actor.getStage() != null) {
            actor.getStage().setKeyboardFocus(actor);
        }
    }