Sets the session state.

@param state The session state.
@return The session state.
343203
public ClientSessionState setState(Session.State state) {
    if (state != Session.State.UNSTABLE) {
      if (this.state != state) {
        return setStateAndCallListeners(state);
      }
    } else {
      if (this.state == Session.State.UNSTABLE) {
        if (unstabilityTimeout > 0 && (System.currentTimeMillis() - unstableSince) > unstabilityTimeout) {
          return setStateAndCallListeners(Session.State.STALE);
        }
      } else if (this.state != Session.State.STALE) {
        unstableSince = System.currentTimeMillis();
        return setStateAndCallListeners(state);
      }
    }

    return this;
  }
306258
public void setState(TransferState state) {
        synchronized (this) {
            this.state = state;
        }
        for ( TransferStateChangeListener listener : stateChangeListeners ) {
            listener.transferStateChanged(this, state);
        }
    }
395528
private static ThreadState state()
    {
        ThreadState state=(ThreadState)__states.get();
        if (state==null)
        {
            state=new ThreadState();
            __states.set(state);
        }
        return state;
    }
284568
@Override
  @SuppressWarnings("unchecked")
  public <E> E getState(Class<E> stateType) {
    return stateType == CxDxSessionState.class ? (E) this.sessionData.getCxDxSessionState() : null;
  }
1016421
public static WindowState getWindowState(String state) {
        if (state == null) {
            return null;
        }

        final WindowState windowState = WINDOW_STATES.get(state);
        if (windowState != null) {
            return windowState;
        }

        return new WindowState(state);
    }
839906
public int setState(boolean state, boolean bDisplayOption, int iMoveMode)
    {       // Must be overidden
        m_bSetData = true;  // Make sure getNextConverter is called correctly (if it is called).
        int iErrorCode = super.setState(state, bDisplayOption, iMoveMode);
        m_bSetData = false;
        return iErrorCode;
    }
1170395
@Override
  public void initState(State state) {
    this.state = state;
    // initalize internal windowing state
    super.initState(this.state);
    // initialize user defined state
    if (!this.state.containsKey(USER_STATE)) {
      this.state.put(USER_STATE, new HashMapState<K, V>());
    }
    this.statefulWindowedBolt.initState((State<K, V>) this.state.get(USER_STATE));
  }
122937
def set_state(block, state):
        
        if block is None:
            return
        user_state = block.userState()
        if user_state == -1:
            user_state = 0
        higher_part = user_state & 0x7FFF0000
        state &= 0x0000FFFF
        state |= higher_part
        block.setUserState(state)
744364
public void restoreState(FacesContext context, Object state)
    {
        if (state != null)
        {
            methodExpression = (MethodExpression) state;
        }
    }
230530
public int setState(boolean state, boolean bDisplayOption, int moveMode)
    {
        double value = 0;
        if (state)
            value = 1;
        return this.setValue(value, bDisplayOption, moveMode);  // Move value to this field
    }
170139
@Override
  @SuppressWarnings("unchecked")
  public <E> E getState(Class<E> stateType) {
    return stateType == S6aSessionState.class ? (E) this.sessionData.getS6aSessionState() : null;
  }
929193
def set_state(self, state):
        
        _field = self.binary_state_name()
        values = {"desired_state": {_field: state}}
        response = self.api_interface.local_set_state(self, values, type_override="binary_switche")
        self._update_state_from_response(response)
554439
private void setState(final EvaluatorState toState) {
    while (true) {

      final EvaluatorState fromState = this.state.get();
      if (fromState == toState) {
        break;
      }

      if (!fromState.isLegalTransition(toState)) {
        LOG.log(Level.WARNING, "Illegal state transition: {0} -> {1}", new Object[] {fromState, toState});
        throw new IllegalStateException("Illegal state transition: " + fromState + " -> " + toState);
      }

      if (this.state.compareAndSet(fromState, toState)) {
        break;
      }
    }
  }
1265153
public function setState($state)
    {
        $this->complement['state'] = $state;
        $this->states['state'] = $state;
        $this->setStates();

        return $state;
    }
214189
public function set_state($state) {
        if ($state <= $this->state) {
            return false;
        }
        $this->state = $state;
        return true;
    }
868392
public function setState(StateInterface $state): StateManagerInterface
    {
        $this->collection->offsetSet($state->getIdentifier()->getId(), $state);
        
        return $this;
    }
585527
protected function setState($state)
    {
        $serviceService = $this->getServiceLocator()->get(StateStorage::SERVICE_ID);
        $userUri = $this->getSession()->getUserUri();
        return is_null($userUri) ? false : $serviceService->set($userUri, $this->getServiceCallId(), $state);
    }