Update a connection pool
497619
def update_connector_c_pool(name, server=None, **kwargs):
    '''
    
    '''
    if 'transactionSupport' in kwargs and kwargs['transactionSupport'] not in (
               'XATransaction',
               'LocalTransaction',
               'NoTransaction'
       ):
        raise CommandExecutionError('Invalid transaction support')
    return _update_element(name, 'resources/connector-connection-pool', kwargs, server)
1108717
def update_subnetpool(self, subnetpool, body=None):
        """"""
        return self.put(self.subnetpool_path % (subnetpool), body=body)
729700
def connection_from_pool_key(self, pool_key, request_context=None):
        
        with self.pools.lock:
            # If the scheme, host, or port doesn't match existing open
            # connections, open a new ConnectionPool.
            pool = self.pools.get(pool_key)
            if pool:
                return pool

            # Make a fresh ConnectionPool of the desired type
            scheme = request_context['scheme']
            host = request_context['host']
            port = request_context['port']
            pool = self._new_pool(scheme, host, port, request_context=request_context)
            self.pools[pool_key] = pool

        return pool
343629
public void notifyConnectionDirty(String url) {
		JMXMonConnection connection = (JMXMonConnection)pool.get(url);
		
		if (connection != null){
			connection.setNewActiveConnection(null, null);
		}
	}
1245234
def update(self, loadbalancer, name=None, algorithm=None, protocol=None,
            halfClosed=None, port=None, timeout=None, httpsRedirect=None):
        
        return self._manager.update(loadbalancer, name=name,
                algorithm=algorithm, protocol=protocol, halfClosed=halfClosed,
                port=port, timeout=timeout, httpsRedirect=httpsRedirect)
1171475
public void updateDatabase(String pool) {

        Map<String, String> dbPoolData = new HashMap<String, String>(m_dbPools.get(pool));

        // display info
        System.out.println("JDBC Driver:                " + getDbDriver(pool));
        System.out.println("JDBC Connection Url:        " + getDbUrl(pool));
        System.out.println("JDBC Connection Url Params: " + getDbParams(pool));
        System.out.println("Database User:              " + getDbUser(pool));

        // get the db implementation name
        String dbName = getDbName();
        String name = null;
        if (dbName.indexOf("mysql") > -1) {
            getMySqlEngine(dbPoolData);
            name = "mysql";
        } else if (dbName.indexOf("oracle") > -1) {
            getOracleTablespaces(dbPoolData);
            name = "oracle";
        } else if (dbName.indexOf("postgresql") > -1) {
            getPostgreSqlTablespaces(dbPoolData);
            name = "postgresql";
        } else {
            System.out.println("db " + dbName + " not supported");
            return;
        }

        // execute update
        Iterator<I_CmsUpdateDBPart> it = m_plugins.iterator();
        while (it.hasNext()) {
            I_CmsUpdateDBPart updatePart = it.next();
            I_CmsUpdateDBPart dbUpdater = getInstanceForDb(updatePart, name);
            if (dbUpdater != null) {
                dbUpdater.execute(dbPoolData);
            }
        }
    }
165924
private void reloadPoolsConfig()
      throws IOException, SAXException, ParserConfigurationException {
    if (poolsConfigFileName == null) {
      return;
    }
    Set<String> newPoolGroupNameSet = new HashSet<String>();
    Set<PoolInfo> newPoolInfoSet = new HashSet<PoolInfo>();
    TypePoolGroupNameMap<Integer> newTypePoolNameGroupToMax =
        new TypePoolGroupNameMap<Integer>();
    TypePoolGroupNameMap<Integer> newTypePoolNameGroupToMin =
        new TypePoolGroupNameMap<Integer>();
    TypePoolInfoMap<Integer> newTypePoolInfoToMax =
        new TypePoolInfoMap<Integer>();
    TypePoolInfoMap<Integer> newTypePoolInfoToMin =
        new TypePoolInfoMap<Integer>();
    Map<PoolInfo, ScheduleComparator> newPoolInfoToComparator =
        new HashMap<PoolInfo, ScheduleComparator>();
    Map<PoolInfo, Double> newPoolInfoToWeight =
        new HashMap<PoolInfo, Double>();
    Map<PoolInfo, Integer> newPoolInfoToPriority =
        new HashMap<PoolInfo, Integer>();
    Map<PoolInfo, String> newPoolInfoToWhitelist = 
        new HashMap<PoolInfo, String>();

    Map<PoolInfo, PoolInfo> newJobExceedsLimitPoolRedirect = new HashMap<PoolInfo, PoolInfo>();
    Map<PoolInfo, Long> newPoolJobSizeLimit = new HashMap<PoolInfo, Long>();

    Element root = getRootElement(poolsConfigFileName);
    NodeList elements = root.getChildNodes();
    for (int i = 0; i < elements.getLength(); ++i) {
      Node node = elements.item(i);
      if (!(node instanceof Element)) {
        continue;
      }
      Element element = (Element) node;
      if (matched(element, GROUP_TAG_NAME)) {
        String groupName = element.getAttribute(NAME_ATTRIBUTE);
        if (!newPoolGroupNameSet.add(groupName)) {
          LOG.debug("Already added group " + groupName);
        }
        NodeList groupFields = element.getChildNodes();
        for (int j = 0; j < groupFields.getLength(); ++j) {
          Node groupNode = groupFields.item(j);
          if (!(groupNode instanceof Element)) {
            continue;
          }
          Element field = (Element) groupNode;
          for (ResourceType type : TYPES) {
            if (matched(field, MIN_TAG_NAME_PREFIX + type)) {
              int val = Integer.parseInt(getText(field));
              newTypePoolNameGroupToMin.put(type, groupName, val);
            }
            if (matched(field, MAX_TAG_NAME_PREFIX + type)) {
              int val = Integer.parseInt(getText(field));
              newTypePoolNameGroupToMax.put(type, groupName, val);
            }
          }
          if (matched(field,REDIRECT_JOB_WITH_LIMIT)){
            loadPoolInfoToRedirect(groupName,
                                  field.getAttribute(SOURCE_ATTRIBUTE),
                                  field.getAttribute(DESTINATION_ATTRIBUTE),
                                  field.getAttribute(JOB_INPUT_SIZE_LIMIT_ATTRIBUTE),
                                  newJobExceedsLimitPoolRedirect,
                                  newPoolJobSizeLimit);
          }
          if (matched(field, POOL_TAG_NAME)) {
            PoolInfo poolInfo = new PoolInfo(groupName,
                                             field.getAttribute("name"));
            if (!newPoolInfoSet.add(poolInfo)) {
              LOG.warn("Already added pool info " + poolInfo);
            }
            NodeList poolFields = field.getChildNodes();
            for (int k = 0; k < poolFields.getLength(); ++k) {
              Node poolNode = poolFields.item(k);
              if (!(poolNode instanceof Element)) {
                continue;
              }
              Element poolField = (Element) poolNode;
              for (ResourceType type : TYPES) {
                if (matched(poolField, MIN_TAG_NAME_PREFIX + type)) {
                  int val = Integer.parseInt(getText(poolField));
                  newTypePoolInfoToMin.put(type, poolInfo, val);
                }
                if (matched(poolField, MAX_TAG_NAME_PREFIX + type)) {
                  int val = Integer.parseInt(getText(poolField));
                  newTypePoolInfoToMax.put(type, poolInfo, val);
                }
              }
              if (matched(poolField, PREEMPTABILITY_MODE_TAG_NAME)) {
                boolean val = Boolean.parseBoolean(getText(poolField));
                if (!val) {
                  nonPreemptablePools.add(poolInfo);
                }
              }
              if (matched(poolField, REQUEST_MAX_MODE_TAG_NAME)) {
                boolean val = Boolean.parseBoolean(getText(poolField));
                if (val) {
                  requestMaxPools.add(poolInfo);
                }
              }
              if (matched(poolField, SCHEDULING_MODE_TAG_NAME)) {
                ScheduleComparator val =
                    ScheduleComparator.valueOf(getText(poolField));
                newPoolInfoToComparator.put(poolInfo, val);
              }
              if (matched(poolField, WEIGHT_TAG_NAME)) {
                double val = Double.parseDouble(getText(poolField));
                newPoolInfoToWeight.put(poolInfo, val);
              }
              if (matched(poolField, PRIORITY_TAG_NAME)) {
                int val = Integer.parseInt(getText(poolField));
                newPoolInfoToPriority.put(poolInfo, val);
              }
              if (matched(poolField, WHITELIST_TAG_NAME)) {
                newPoolInfoToWhitelist.put(poolInfo, getText(poolField));
              }
            }
          }
        }
      }
    }
    synchronized (this) {
      this.poolGroupNameSet = newPoolGroupNameSet;
      this.poolInfoSet = Collections.unmodifiableSet(newPoolInfoSet);
      this.typePoolGroupNameToMax = newTypePoolNameGroupToMax;
      this.typePoolGroupNameToMin = newTypePoolNameGroupToMin;
      this.typePoolInfoToMax = newTypePoolInfoToMax;
      this.typePoolInfoToMin = newTypePoolInfoToMin;
      this.poolInfoToComparator = newPoolInfoToComparator;
      this.poolInfoToWeight = newPoolInfoToWeight;
      this.poolInfoToPriority = newPoolInfoToPriority;
      this.poolInfoToWhitelist = newPoolInfoToWhitelist;
      this.jobExceedsLimitPoolRedirect = newJobExceedsLimitPoolRedirect;
      this.poolJobSizeLimit = newPoolJobSizeLimit;
    }
  }
1338323
def after_insert_oai_set(mapper, connection, target):
    """"""
    _new_percolator(spec=target.spec, search_pattern=target.search_pattern)
    sleep(2)
    update_affected_records.delay(
        search_pattern=target.search_pattern
    )
1260530
def update_connection_public_key(self, connection_id, public_key):
        
        if connection_id in self._connections:
            connection_info = self._connections[connection_id]
            self._connections[connection_id] = \
                ConnectionInfo(connection_info.connection_type,
                               connection_info.connection,
                               connection_info.uri,
                               connection_info.status,
                               public_key)
        else:
            LOGGER.debug("Could not update the public key %s for "
                         "connection_id %s. The connection does not "
                         "exist.",
                         public_key,
                         connection_id)
509271
void releaseConnection(ConnectionPool pool, Cassandra.Client conn)
    {
        if (pool != null && conn != null)
        {
            pool.release(conn);
        }
    }
203445
private function processConnectionPool(): void
    {
        $readableConnections = $this->connectionPool->getReadableConnections(5);

        foreach ($readableConnections as $id => $connection) {
            if (!isset($this->connectionHandlers[$id])) {
                $this->connectionHandlers[$id] = $this->connectionHandlerFactory->createConnectionHandler($this->kernel, $connection);
            }

            try {
                $statusCodes = $this->connectionHandlers[$id]->ready();
                $this->considerStatusCodes($statusCodes);
            } catch (UserlandDaemonException $exception) {
                $this->daemonOptions->getOption(DaemonOptions::LOGGER)->error($exception->getMessage());
            }

            if ($this->connectionHandlers[$id]->isClosed()) {
                unset($this->connectionHandlers[$id]);
            }
        }
    }
1102703
public synchronized boolean addPool(HostConnectionPool<CL> pool) {
        if (this.pools.add(pool)) {
            refresh();
            return true;
        }
        return false;
    }
1322784
function(pool) {
    if (idleConnections.isEmpty()) {
      return Promise.reject(null);
    }
    const conn = idleConnections.shift();
    activeConnections[conn.threadId] = conn;
    if (
      opts.minDelayValidation <= 0 ||
      Date.now() - conn.lastUse > opts.minDelayValidation
    ) {
      return pingPromise(conn)
        .then(() => {
          return Promise.resolve(conn);
        })
        .catch(err => {
          delete activeConnections[conn.threadId];
          pool.emit('remove-conn');
          return getIdleValidConnection(pool);
        });
    } else {
      //just check connection state
      if (conn.isValid()) {
        return Promise.resolve(conn);
      } else {
        delete activeConnections[conn.threadId];
        pool.emit('remove-conn');
        return getIdleValidConnection(pool);
      }
    }
  }
899215
public void refreshConnection() throws SQLException{
		this.connection.close(); // if it's still in use, close it.
		try{
			this.connection = this.pool.obtainRawInternalConnection();
		} catch(SQLException e){
			throw markPossiblyBroken(e);
		}
	}
1064189
def ConnectionUpdate(self, settings):
    '''
    '''
    connection_path = self.connection_path

    NM = dbusmock.get_object(MANAGER_OBJ)
    settings_obj = dbusmock.get_object(SETTINGS_OBJ)

    main_connections = settings_obj.ListConnections()

    if connection_path not in main_connections:
        raise dbus.exceptions.DBusException(
            'Connection %s does not exist' % connection_path,
            name=MANAGER_IFACE + '.DoesNotExist',)

    # Take care not to overwrite the secrets
    for setting_name in settings:
        setting = settings[setting_name]
        for k in setting:
            if setting_name not in self.settings:
                self.settings[setting_name] = {}
            self.settings[setting_name][k] = setting[k]

    self.EmitSignal(CSETTINGS_IFACE, 'Updated', '', [])

    auto_connect = False
    if 'autoconnect' in settings['connection']:
        auto_connect = settings['connection']['autoconnect']

    if auto_connect:
        dev = None
        devices = NM.GetDevices()

        # Grab the first device.
        if len(devices) > 0:
            dev = devices[0]

        if dev:
            activate_connection(NM, connection_path, dev, connection_path)

    return connection_path
142324
async def refresh(self) -> None:
        

        LOGGER.debug('NodePool.refresh >>>')

        await pool.refresh_pool_ledger(self.handle)

        LOGGER.debug('NodePool.refresh <<<')
443357
def update_session(fname=None):
    """"""
    if fname is None:
        fname = conf.session
    try:
        s = six.moves.cPickle.load(gzip.open(fname, "rb"))
    except IOError:
        s = six.moves.cPickle.load(open(fname, "rb"))
    scapy_session = six.moves.builtins.__dict__["scapy_session"]
    scapy_session.update(s)
    update_ipython_session(scapy_session)