Set keep-alive connection mode.

        :param bool val: new state.
12302
def keep_alive(self, val: bool) -> None:
        
        self._keepalive = val
        if self._keepalive_handle:
            self._keepalive_handle.cancel()
            self._keepalive_handle = None
935732
public static boolean isKeepAlive(KeepAliveConfig keepAliveConfig, HttpCarbonMessage outboundRequestMsg)
            throws ConfigurationException {
        switch (keepAliveConfig) {
        case AUTO:
            return Float.valueOf((String) outboundRequestMsg.getProperty(Constants.HTTP_VERSION)) > Constants.HTTP_1_0;
        case ALWAYS:
            return true;
        case NEVER:
            return false;
        default:
            // The execution will never reach here. In case execution reach here means it should be an invalid value
            // for keep-alive configurations.
            throw new ConfigurationException("Invalid keep-alive configuration value : "
                    + keepAliveConfig.toString());
        }
    }
971629
def blocked=(val)
      if ! [ true, false ].include?(val)
        raise ArgumentError, "value must be a boolean"
      end
      @o_dev[I_DEVICE]['Blocked'] = val
    end
1122793
def keep_alive(self):
        
        while True:
            pid = self.execute_in_background()
            p = psutil.Process(pid)
            while p.is_running() and str(p.status) != 'zombie':
                os.system('sleep 5')
828368
def steady_connection(self):
        """"""
        return SteadyPgConnection(self._maxusage, self._setsession, True,
                                  *self._args, **self._kwargs)
537569
def change_to_connected_state
      return unless @http

      @max_stream_count = @http.remote_settings[:settings_max_concurrent_streams]
      @connected = true

      info "Connection established."
      debug "Maximum number of streams: #{@max_stream_count}. Flushing #{@request_queue.size} enqueued requests."

      @request_queue.size.times do
        async.try_to_perform_request!
      end

      @heartbeat = every(HEARTBEAT_INTERVAL) do
        debug "Sending heartbeat ping..."
        begin
          future.ping.call(HEARTBEAT_TIMEOUT)
          debug "Got heartbeat reply."
        rescue Celluloid::TimedOut
          raise TimedOut, "Heartbeat ping timed-out."
        end
      end
    end
187882
public void setTextKeepUpright( Boolean value) {
    PropertyValue propertyValue = textKeepUpright(value);
    constantPropertyUsageMap.put(PROPERTY_TEXT_KEEP_UPRIGHT, propertyValue);
    layer.setProperties(propertyValue);
  }
1094524
public void setValue(boolean val) {
    try {
      super.setValue(Boolean.valueOf(val));
    }
    catch(ParameterException e) {
      // We're pretty sure that any Boolean is okay, so this should never be
      // reached.
      throw new AbortException("Flag did not accept boolean value!", e);
    }
  }
543568
def set_on_level(self, val):
        """"""
        on_cmd = self._create_set_property_msg("_on_level", 0x06,
                                               val)
        self._send_method(on_cmd, self._property_set)
        self._send_method(on_cmd, self._on_message_received)
667647
def stp(self, val=True):
        
        if val: state = 'on' 
        else: state = 'off'
        _runshell([brctlexe, 'stp', self.name, state],
            "Could not set stp on %s." % self.name)
927967
function set_network_active( $is_network_active = true, $is_delegated_connection = false ) {
            $this->_is_network_active       = $is_network_active;
            $this->_is_delegated_connection = $is_delegated_connection;
        }
762906
public synchronized void onTransportActive() {
    if (state == State.IDLE) {
      // When the transport goes active, we do not reset the nextKeepaliveTime. This allows us to
      // quickly check whether the connection is still working.
      state = State.PING_SCHEDULED;
      if (pingFuture == null) {
        pingFuture = scheduler.schedule(
            sendPing,
            keepAliveTimeInNanos - stopwatch.elapsed(TimeUnit.NANOSECONDS),
            TimeUnit.NANOSECONDS);
      }
    } else if (state == State.IDLE_AND_PING_SENT) {
      state = State.PING_SENT;
    } // Other states are possible when keepAliveDuringTransportIdle == true
  }
564714
async def handle_forever(self):
        
        while self.connected:
            data = await self.connection.recv()
            if not data:
                if self.connected:
                    await self.disconnect(expected=False)
                break
            await self.on_data(data)
964886
def store(self, key, pk, value):
        

        self.connection.zadd(key, value, pk)
42354
def mode(self, target, *data):
        """"""
        self.send_line('MODE %s %s' % (target, ' '.join(data)), nowait=True)
157936
def set(self, val, lifetime=None):
        
        cache.set(self.key,
                  (json.dumps(val) if self.serialize else val),
                  lifetime or settings.DEFAULT_CACHE_EXPIRE_TIME)
        return val
981645
def set_(key, value, profile=None):
    '''
    
    '''
    if not profile:
        return False
    conn, cur, table = _connect(profile)
    if six.PY2:
        value = buffer(salt.utils.msgpack.packb(value))
    else:
        value = memoryview(salt.utils.msgpack.packb(value))
    q = profile.get('set_query', ('INSERT OR REPLACE INTO {0} VALUES '
                                  '(:key, :value)').format(table))
    conn.execute(q, {'key': key, 'value': value})
    conn.commit()
    return True