INNER CODE UNIT · Java

tryStopThread

RuedigerMoeller/kontraktor · attic/ElasticScheduler.java:471

    public void tryStopThread(DispatcherThread dispatcherThread) {
        if ( dispatcherThread != Thread.currentThread() )
            throw new RuntimeException("bad one");
        synchronized (balanceLock) {
            DispatcherThread minLoadThread = findMinLoadThread(Integer.MAX_VALUE, dispatcherThread);
            if (minLoadThread == null)
                return;
            // move to actor with minimal load
            Actor qList[] = dispatcherThread.getActors();
            for (int i = 0; i < threads.length; i++) { // avoid further dispatch
                if ( threads[i] == dispatcherThread ) {
                    threads[i] = null;
                }
            }
            int maxActors2Remove = Math.min(qList.length, qList.length / 5 + 1); // do several steps to get better spread
            for (int i = 0; i < maxActors2Remove; i++)
            {
                Actor actor = qList[i];

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…