Change to {@link ConnectionState#SUSPENDED} only if not already suspended and not lost

@return true if connection is set to SUSPENDED
14550
public synchronized boolean setToSuspended()
    {
        if ( state.get() != State.STARTED )
        {
            return false;
        }

        if ( (currentConnectionState == ConnectionState.LOST) || (currentConnectionState == ConnectionState.SUSPENDED) )
        {
            return false;
        }

        currentConnectionState = ConnectionState.SUSPENDED;
        postState(ConnectionState.SUSPENDED);

        return true;
    }
641999
private void setStatus(ConnectionStatus status){
        if(LOGGER.isDebugEnabled()){
            LOGGER.debug("Set status to - " + status);
        }
        if(! this.status.equals(status)){
            ConnectionStatus pre = this.status;
            this.status = status;
            eventThread.queueClientEvent(new ClientStatusEvent(pre, status));
        }
    }
943576
@Override
    public void suspendAssociation() {
        final boolean traceOn = TraceComponent.isAnyTracingEnabled();

        if (traceOn && tc.isEntryEnabled())
            Tr.entry(tc, "suspendAssociation");

        suspendAssociation(false);

        if (traceOn && tc.isEntryEnabled())
            Tr.exit(tc, "suspendAssociation");
    }
1036358
boolean processUnstable() {
        boolean change = !unstable;
        if (change) {  // Only once until the process is removed. A process is unstable until removed.
            unstable = true;
            HostControllerLogger.ROOT_LOGGER.managedServerUnstable(serverName);
        }
        return change;
    }
817918
public synchronized void setReconnecting(boolean b) {
        reconnecting = b;
        if (transaction != null) {
            ((ModbusTCPTransaction)transaction).setReconnecting(b);
        }
    }
370516
public boolean connectIfNeeded() {
        if (getDDP().getState() == CONNSTATE.Disconnected) {
            // make connection to Meteor server
            getDDP().connect();
            return true;
        } else if (getDDP().getState() == CONNSTATE.Closed) {
           // try to reconnect w/ a new connection
            createDDPClient();
            getDDP().connect();
        }
        return false;
    }
1131671
public boolean changeState(StateVertex nextState) {
		if (nextState == null) {
			LOGGER.info("nextState given is null");
			return false;
		}
		LOGGER.debug("Trying to change to state: '{}' from: '{}'", nextState.getName(),
				currentState.getName());

		if (stateFlowGraph.canGoTo(currentState, nextState)) {

			LOGGER.debug("Changed to state: '{}' from: '{}'", nextState.getName(),
					currentState.getName());

			setCurrentState(nextState);

			return true;
		} else {
			LOGGER.info("Cannot go to state: '{}' from: '{}'", nextState.getName(),
					currentState.getName());
			return false;
		}
	}
106887
public boolean isConnected(String clusterName) {
        boolean isConnected = false;
        synchronized (connections) {
            if (connections.containsKey(clusterName)) {
                isConnected = connections.get(clusterName).isConnected();
            }
        }
        return isConnected;
    }
1354717
public boolean suspendConsumer(int suspendFlag)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "suspendConsumer", Integer.valueOf(suspendFlag));
    
    boolean didSuspendConsumer;
    // Lock down the consumerpoint and suspend it
    this.lock();
    try
    {
      if (!isConsumerSuspended(suspendFlag)) // Is the consumer already suspended
      {
        _consumerSuspended = true;
        _suspendFlags |= suspendFlag;
        this.isready = false;
        ck.notReady();
        didSuspendConsumer = true;
      }
      else
      {
        didSuspendConsumer = false;
      }
    }
    finally
    {
      this.unlock();
    }
     
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "suspendConsumer", didSuspendConsumer);
    return didSuspendConsumer;
  }
700011
boolean isKeepaliveAllowed(long connectionStartTime)
  {
    if (! _lifecycle.isActive()) {
      return false;
    }
    else if (connectionStartTime + _keepaliveTimeMax < CurrentTime.currentTime()) {
      return false;
    }
    else if (_keepaliveMax <= _keepaliveAllocateCount.get()) {
      return false;
    }
    /*
    else if (_connThreadPool.isThreadMax()
             && _connThreadPool.isIdleLow()
             && ! isKeepaliveAsyncEnabled()) {
      return false;
    }
    */
    else {
      return true;
    }
  }
504226
public boolean setIf(T newState, Predicate<T> predicate)
    {
        checkState(!Thread.holdsLock(lock), "Can not set state while holding the lock");
        requireNonNull(newState, "newState is null");

        while (true) {
            // check if the current state passes the predicate
            T currentState = get();

            // change to same state is not a change, and does not notify the notify listeners
            if (currentState.equals(newState)) {
                return false;
            }

            // do not call predicate while holding the lock
            if (!predicate.test(currentState)) {
                return false;
            }

            // if state did not change while, checking the predicate, apply the new state
            if (compareAndSet(currentState, newState)) {
                return true;
            }
        }
    }
674720
public static boolean isTerminating(Service.State state) {
        return state == Service.State.STOPPING
                || state == Service.State.TERMINATED
                || state == Service.State.FAILED;
    }
6543
@Override
  public boolean canOpenWarm()
  {
    State state = _state;

    if (state == State.ACTIVE) {
      return true;
    }
    else if (state.isEnabled()) {
      long now = CurrentTime.currentTime();

      if (isFailed(now)) {
        return false;
      }

      long firstSuccessTime = _firstSuccessTime;
      int warmupState = 0;

      if (firstSuccessTime > 0) {
        warmupState = (int) ((now - firstSuccessTime) / _warmupChunkTime);
      }

      warmupState -= _currentFailCount;

      if (warmupState < 0) {
        return (_failTime - warmupState * _failChunkTime < now);
      }
      else if (WARMUP_MAX <= warmupState) {
        return true;
      }

      int connectionMax = WARMUP_CONNECTION_MAX[warmupState];

      int idleCount = getIdleCount();
      int activeCount = _activeCount.get() + _startingCount.get();
      int totalCount = activeCount + idleCount;
      
      return totalCount < connectionMax;
    }
    else {
      return false;
    }
  }
1117364
public boolean isNull() {
        if (ip == null) {
            return true;
        } else if (ip.length() == 0) {
            return true;
        } else if (port < 0) {
            return true;
        } else {
            return false;
        }
    }
513833
public static boolean isConnected(Context context) {
    if (!hasPermission(context, ACCESS_NETWORK_STATE)) {
      return true; // Assume we have a connection and try to upload.
    }
    ConnectivityManager cm = getSystemService(context, CONNECTIVITY_SERVICE);
    @SuppressLint("MissingPermission")
    NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
    return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
  }
426728
public boolean limit() {

        //get connection
        Object connection = getConnection();

        Object result = limitRequest(connection);

        if (FAIL_CODE != (Long) result) {
            return true;
        } else {
            return false;
        }
    }
350492
protected boolean checkConnection()
    {
        super.checkConnection();
        try
        {
            if (_jarConnection!=_connection)
                newConnection();
        }
        catch(IOException e)
        {
            LogSupport.ignore(log,e);
            _jarConnection=null;
        }
        
        return _jarConnection!=null;
    }