call workstate.adverse(workers)
@see nyla.solutions.core.patterns.workthread.Supervisor#setWorkState(nyla.solutions.core.patterns.workthread.WorkState)
354639
public void setWorkState(WorkState workState)
   {
      this.workState =  workState;
      
      SupervisedWorker worker = null;
      for (Iterator<SupervisedWorker> i = workers.iterator(); i.hasNext();)
      {
         worker = (SupervisedWorker) i.next();
         workState.advise(worker);
      }
      
      //threads
      Thread workerThread = null;
      
      for (Iterator<SupervisedWorker> i = workers.iterator(); i.hasNext();)
      {
         worker = i.next();
         workerThread = worker.getThread();
         if(workerThread != null)
         {
            try { workerThread.join(); } catch(Exception e){}   
         }
      }
   }
769159
public void manage(int workersCount)
   {
      this.workers.clear();
      
      WorkerThread worker = null;
      for (int i = 0; i <workersCount; i++)
      {
         worker = new WorkerThread(this); //TODO expensive use thread pool
         this.manage(worker);         
      }
      
   }
1050728
public void setWorkspacesConnectionStatus(java.util.Collection<WorkspaceConnectionStatus> workspacesConnectionStatus) {
        if (workspacesConnectionStatus == null) {
            this.workspacesConnectionStatus = null;
            return;
        }

        this.workspacesConnectionStatus = new com.amazonaws.internal.SdkInternalList<WorkspaceConnectionStatus>(workspacesConnectionStatus);
    }
8219
boolean assign(Work work, boolean self)
    {
        Work state = get();
        while (state.canAssign(self))
        {
            if (!compareAndSet(state, work))
            {
                state = get();
                continue;
            }
            // if we were spinning, exit the state (decrement the count); this is valid even if we are already spinning,
            // as the assigning thread will have incremented the spinningCount
            if (state.isSpinning())
                stopSpinning();

            // if we're being descheduled, place ourselves in the descheduled collection
            if (work.isStop())
                pool.descheduled.put(workerId, this);

            // if we're currently stopped, and the new state is not a stop signal
            // (which we can immediately convert to stopped), unpark the worker
            if (state.isStopped() && (!work.isStop() || !stop()))
                LockSupport.unpark(thread);
            return true;
        }
        return false;
    }
220487
final void runWorker(WorkQueue w) {
        w.growArray(false);         // initialize queue array in this thread
        do { w.runTask(scan(w)); } while (w.runState >= 0);
    }
491455
public void setMaxWorkers(int maxWorkers) {
    synchronized (workerQueue) {
      idleLock.lock();
      try {
        int oldMaxWorkers = this.maxWorkers;
        this.maxWorkers = maxWorkers;

        // If the number of workers is being reduced, then signal any
        // waiting workers so that they can terminate themselves if
        // their id is greater than the number of workers, and so that
        // another worker can take over idle polling if the current
        // polling worker is to be terminated.
        if (maxWorkers < oldMaxWorkers) {
          idleComplete.signalAll();
        }
      } finally {
        idleLock.unlock();
      }
      while (numWorkers < maxWorkers) {
        String title = String.format("Worker (%d)", numWorkers + 1);
        ProgressMonitorWrapper monitor = new ProgressMonitorWrapper(numWorkers++, monitorFactory.createProgressMonitor(title));
        workerQueue.add(new Worker(monitor));
      }
    }
  }
1060976
def setNumWorkers(self, num_workers):
        """"""
        cur_num = len(self.workers)
        if cur_num > num_workers:
            self.dismissWorkers(cur_num - num_workers)
        else:
            self.createWorkers(num_workers - cur_num)
1138540
public void setWorkingDirectory(Path dir) throws IOException {
    ensureState(JobState.DEFINE);
    conf.setWorkingDirectory(dir);
  }
322475
public void setTaskMaxThreads(Integer maxThreads) throws SecurityException {
	checkWriteAccess();
	boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
	if (!hasAccess) throw new SecurityException("no access to update task settings");
	Element mail = _getRootElement("remote-clients");
	mail.setAttribute("max-threads", Caster.toString(maxThreads, ""));
    }
1014911
public void start() {
        switch (WORKER_STATE_UPDATER.get(this)) {
            case WORKER_STATE_INIT:
                if (WORKER_STATE_UPDATER.compareAndSet(this, WORKER_STATE_INIT, WORKER_STATE_STARTED)) {
                    workerThread.start();
                }
                break;
            case WORKER_STATE_STARTED:
                break;
            case WORKER_STATE_SHUTDOWN:
                throw new IllegalStateException("cannot be started once stopped");
            default:
                throw new Error("Invalid WorkerState");
        }

        // Wait until the startTime is initialized by the worker.
        while (startTime == 0) {
            try {
                startTimeInitialized.await();
            } catch (InterruptedException ignore) {
                // Ignore - it will be ready very soon.
            }
        }
    }
812240
public void setEveryWorkingDay(final boolean isEveryWorkingDay) {

        if (m_model.isEveryWorkingDay() != isEveryWorkingDay) {
            removeExceptionsOnChange(new Command() {

                public void execute() {

                    m_model.setEveryWorkingDay(Boolean.valueOf(isEveryWorkingDay));
                    m_model.setInterval(getPatternDefaultValues().getInterval());
                    onValueChange();
                }
            });
        }
    }
1075704
@Override
    public void setState(MotorState state) {

        switch(state) {
            case STOP: {
                // set internal tracking state
                currentState = MotorState.STOP;

                // turn all GPIO pins to OFF state
                for(GpioPinDigitalOutput pin : pins)
                    pin.setState(offState);

                break;
            }
            case FORWARD: {
                // set internal tracking state
                currentState = MotorState.FORWARD;

                // start control thread if not already running
                if(!controlThread.isAlive()) {
                    controlThread = new GpioStepperMotorControl();
                    controlThread.start();
                }

                break;
            }
            case REVERSE: {
                // set internal tracking state
                currentState = MotorState.REVERSE;

                // start control thread if not already running
                if(!controlThread.isAlive()) {
                    controlThread = new GpioStepperMotorControl();
                    controlThread.start();
                }

                break;
            }
            default: {
                throw new UnsupportedOperationException("Cannot set motor state: " + state.toString());
            }
        }
    }
45253
public void manage(Collection<SupervisedWorker> workers)
   {
      if(workers == null)
         return;
      
      this.workers.clear();
      
      SupervisedWorker worker = null;
      for (Iterator<SupervisedWorker> i = workers.iterator(); i.hasNext();)
      {
         worker = i.next();
         
         this.manage(worker);
      }
      
   }
1096666
public final void setWork(final long work) {
    if (getWork() != WORK_UNKNOWN) {
      throw new IllegalStateException("Cannot set work amount if it was already previously specified");
    }
    new JAtomic() {
      @Override boolean abort(Job job) { return false; }
      @Override void update(Job old) { old._work = work; }
    }.apply(this);
  }
437207
private void setState(State newState) {
        m_logger.debug("Entering state: {}", newState.toString());
        synchronized (m_stateChangeLock) {
            m_state = newState;
            m_stateChangeLock.notifyAll();
        }
    }
1154654
public synchronized void setWorkbenchEntry(final WorkbenchEntry workbenchEntry) {
		assert ! acquired : this;
		this.workbenchEntry = workbenchEntry;
		if (! isEmpty()) workbenchEntry.add(this, frontier.workbench);
	}
911717
public WorkingState getWorkingState() {
    return WorkingState
        .valueOf(getProp(ConfigurationKeys.WORK_UNIT_WORKING_STATE_KEY, WorkingState.PENDING.toString()));
  }