Sets the session state.

@param state the session state
433287
private synchronized void onStateChange(PrimitiveState state) {
    if (this.state != state) {
      if (state == PrimitiveState.EXPIRED) {
        if (connected) {
          onStateChange(PrimitiveState.SUSPENDED);
          recover();
        } else {
          log.debug("State changed: {}", state);
          this.state = state;
          stateChangeListeners.forEach(l -> l.accept(state));
        }
      } else {
        log.debug("State changed: {}", state);
        this.state = state;
        stateChangeListeners.forEach(l -> l.accept(state));
        if (state == PrimitiveState.CLOSED) {
          connectFuture = Futures.exceptionalFuture(new PrimitiveException.ClosedSession());
          session = null;
        }
      }
    }
  }
214189
public function set_state($state) {
        if ($state <= $this->state) {
            return false;
        }
        $this->state = $state;
        return true;
    }
167750
def set_state(self, state):
        
        SimStatePlugin.set_state(self, state)

        # Delayed initialization
        stack_region_map, generic_region_map = self._temp_stack_region_map, self._temp_generic_region_map

        if stack_region_map or generic_region_map:
            # Inherited from its parent
            self._stack_region_map = stack_region_map.copy()
            self._generic_region_map = generic_region_map.copy()

        else:
            if not self._abstract_backer and o.REGION_MAPPING in self.state.options:
                # Only the top-level SimMemory instance can have region maps.
                self._stack_region_map = RegionMap(True)
                self._generic_region_map = RegionMap(False)

            else:
                self._stack_region_map = None
                self._generic_region_map = None
1179894
public void setState(State state) {
    this.state = state;
    setText(state.isPrimary() ? text1 : text2);
  }
925003
public void setModificationState(ModificationState newModificationState)
    {
        if(newModificationState != modificationState)
        {
            if(log.isDebugEnabled())
            {
                log.debug("object state transition for object " + this.oid + " ("
                        + modificationState + " --> " + newModificationState + ")");
//                try{throw new Exception();}catch(Exception e)
//                {
//                e.printStackTrace();
//                }
            }
            modificationState = newModificationState;
        }
    }
337898
public boolean set(State state) {
    while (true) {
      InternalState internalState = currentInternalState.get();
      checkState(!internalState.isRead, "State was already read, cannot set state.");
      if (state == internalState.state) {
        return false;
      } else {
        if (!currentInternalState.compareAndSet(
            internalState,
            state == State.ENABLED
                ? InternalState.ENABLED_NOT_READ
                : InternalState.DISABLED_NOT_READ)) {
          // The state was changed between the moment the internalState was read and this point.
          // Some conditions may be not correct, reset at the beginning and recheck all conditions.
          continue;
        }
        return true;
      }
    }
  }
1348917
public void setState(State state, boolean fireEvent) {

        boolean changed = m_state != state;
        m_state = state;
        if (changed) {
            updateStyle();
        }
        if (fireEvent) {
            ValueChangeEvent.fire(this, state);
        }
    }
46977
public void setStepStates(java.util.Collection<String> stepStates) {
        if (stepStates == null) {
            this.stepStates = null;
            return;
        }

        this.stepStates = new com.amazonaws.internal.SdkInternalList<String>(stepStates);
    }
170658
public void setState(Object context, String name, Object value) {
        StateInformation si = stateInformation.get(name);
        if (si == null) {
            si = new StateInformation();
            stateInformation.put(name, si);
        }
        si.set(context, value);
    }
49528
private synchronized void setChannelState(String channelName, RuntimeState state) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "setChannelState channelName=" + channelName + ", state=" + state.ordinal);
        }
        if (null != channelName) {
            ChannelContainer channelContainer = this.channelRunningMap.get(channelName);
            if (null != channelContainer) {
                channelContainer.setState(state);
            }
        }
    }
1092224
protected void restore(BaseState state) {
    if (state.buffer != null) {
      this.buffer = state.buffer.clone();
      this.limit = state.buffer.length;
    }
    this.position = state.position;
    this.isOpen = state.isOpen;
    this.chunkSize = state.chunkSize;
  }
1320653
public void setState(S state){
		Integer id = definition.getStateId(state);
		currentStateId.set(id);
	}
1216790
public void setLastState(State s) {
        Entry<Character, State> entry = transitions.lastEntry();
        transitions.put(entry.getKey(), s);
        d_recomputeHash = true;
    }
553984
public function setState(int $state)
    {
        if ($state < 0 || $state > 2) {
            Throw new UserException('Users state value can be 0 (active), 1 (awaits activation by mail) or 2 (awaits activation by admin)');
        }

        $this->state = $state;
    }
824340
void setState(final WidgetState.State state) {
        Log.d(TAG, "setState(%s): state is %s, setting to %s", mWidget.getName(), mState, state);
        if (state != mState) {
            final WidgetState.State nextState = getNextState(state);
            Log.d(TAG, "setState(%s): next state '%s'", mWidget.getName(), nextState);
            if (nextState != mState) {
                Log.d(TAG, "setState(%s): setting state to '%s'", mWidget.getName(), nextState);
                setCurrentState(false);
                mState = nextState;
                setCurrentState(true);
            }
        }
    }
1111385
public static void putStateIntoConfiguration(State state, Configuration configuration) {
    for (String key : state.getPropertyNames()) {
      configuration.set(key, state.getProp(key));
    }
  }
185373
def set_state(self, state):
        
        values = {"desired_state": {"locked": state}}
        response = self.api_interface.local_set_state(self, values)
        self._update_state_from_response(response)