Process the removed ports.
341491
def _process_removed_port(self, device):
        """"""
        LOG.debug("Trying to remove the port %r", device)
        self._update_port_status_cache(device, device_bound=False)
        self._port_unbound(device, vnic_deleted=True)

        LOG.debug("The port was successfully removed.")
        self._removed_ports.discard(device)
879655
def process_data(self, sockets):
        
        with self.mutex:
            log.log(logging.DEBUG - 2, "process_data()")
            for sock, conn in itertools.product(sockets, self.connections):
                if sock == conn.socket:
                    conn.process_data()
1010835
protected function process()
    {

        // clean-up the repositories etc. to free memory
        $this->getCustomerAddressBunchProcessor()->cleanUp();

        // temporary persist the last customer address entity ID
        $this->setLastEntityId($this->getValue(ColumnKeys::ENTITY_ID));
    }
547589
private function cleanupDeadProcesses()
    {
        $processes = ezpContentPublishingProcess::fetchProcesses( ezpContentPublishingProcess::STATUS_WORKING );
        foreach( $processes as $process )
        {
            if ( !$process->isAlive() )
            {
                $process->reset();
            }
        }
    }
486396
synchronized void clearInstance() {
		for (ServerSocket next : myControlSockets) {
			ourLog.info("Releasing control port: {}", next.getLocalPort());
			try {
				next.close();
			} catch (IOException theE) {
				// ignore
			}
		}
		myControlSockets.clear();
		myCurrentControlSocketPort = null;
	}
488866
def hosting_devices_removed(self, context, payload):
        """"""
        try:
            if payload['hosting_data']:
                if payload['hosting_data'].keys():
                    self.process_services(removed_devices_info=payload)
        except KeyError as e:
            LOG.error("Invalid payload format for received RPC message "
                      "`hosting_devices_removed`. Error is %(error)s. Payload "
                      "is %(payload)s", {'error': e, 'payload': payload})
1242009
def _cleanup(self):
        
        for channel in self._open_channels:
            try:
                self.disconnect_channel(channel)
            except Exception:  # pylint: disable=broad-except
                pass

        for handler in self._handlers.values():
            try:
                handler.tear_down()
            except Exception:  # pylint: disable=broad-except
                pass

        try:
            self.socket.close()
        except Exception:  # pylint: disable=broad-except
            self.logger.exception(
                "[%s:%s] _cleanup", self.fn or self.host, self.port)
        self._report_connection_status(
            ConnectionStatus(CONNECTION_STATUS_DISCONNECTED,
                             NetworkAddress(self.host, self.port)))
        self.connecting = True
958967
def _parse_ports(self, ports):
        
        if not ports:
            return []

        return [tuple(port_pair.split("::")) for port_pair in ports.strip(";").split(";")]
1101179
def unmount_process(self, process):
    

    # There is no remove_handlers, but .handlers is public so why not.  server.handlers is a list of
    # 2-tuples of the form (host_pattern, [list of RequestHandler]) objects.  We filter out all
    # handlers matching our process from the RequestHandler list for each host pattern.
    def nonmatching(handler):
      return 'process' not in handler.kwargs or handler.kwargs['process'] != process

    def filter_handlers(handlers):
      host_pattern, handlers = handlers
      return (host_pattern, list(filter(nonmatching, handlers)))

    self.app.handlers = [filter_handlers(handlers) for handlers in self.app.handlers]
882090
def returnPorts(self):
        """"""
        if self._gotPorts:
            #print("deleting ports >%s<"%(self.ports))
            map(portpicker.return_port, self.ports)
            self._gotPorts = False
        self.ports = []
7935
private void discardIdleConnections() {
        List<Connection<CL>> connections = Lists.newArrayList();
        availableConnections.drainTo(connections);
        activeCount.addAndGet(-connections.size());

        for (Connection<CL> connection : connections) {
            try {
                closedConnections.incrementAndGet();
                connection.close(); // This is usually an async operation
            }
            catch (Throwable t) {
                // TODO
            }
        }
    }
157616
def return_port(port):
    """"""
    if port in _random_ports:
        _random_ports.remove(port)
    elif port in _owned_ports:
        _owned_ports.remove(port)
        _free_ports.add(port)
    elif port in _free_ports:
        logging.info("Returning a port that was already returned: %s", port)
    else:
        logging.info("Returning a port that wasn't given by portpicker: %s",
                     port)
150103
def remove_data_flows_with_data_port_id(self, data_port_id):
        
        if not self.is_root_state:
            # delete all data flows in parent related to data_port_id and self.state_id
            data_flow_ids_to_remove = []
            for data_flow_id, data_flow in self.parent.data_flows.items():
                if data_flow.from_state == self.state_id and data_flow.from_key == data_port_id or \
                        data_flow.to_state == self.state_id and data_flow.to_key == data_port_id:
                    data_flow_ids_to_remove.append(data_flow_id)

            for data_flow_id in data_flow_ids_to_remove:
                self.parent.remove_data_flow(data_flow_id)
1294677
def delete_port(self, port):
        '''
        
        '''
        port_id = self._find_port_id(port)
        ret = self.network_conn.delete_port(port=port_id)
        return ret if ret else True
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]);
            }
        }
    }
515242
def process_remove_action(processors, action, argument):
    """"""
    for processor in processors:
        processor(action, argument)
    db.session.commit()
825966
def process_added_port(self, device_details):
        
        device = device_details['device']
        port_id = device_details['port_id']
        reprocess = True
        try:
            self._process_added_port(device_details)

            LOG.debug("Updating cached port %s status as UP.", port_id)
            self._update_port_status_cache(device, device_bound=True)
            LOG.info("Port %s processed.", port_id)
        except os_win_exc.HyperVvNicNotFound:
            LOG.debug('vNIC %s not found. This can happen if the VM was '
                      'destroyed.', port_id)
            reprocess = False
        except os_win_exc.HyperVPortNotFoundException:
            LOG.debug('vSwitch port %s not found. This can happen if the VM '
                      'was destroyed.', port_id)
            # NOTE(claudiub): just to be on the safe side, in case Hyper-V said
            # that the port was added, but it hasn't really, we're leaving
            # reprocess = True. If the VM / vNIC was removed, on the next
            # reprocess, a HyperVvNicNotFound will be raised.
        except Exception as ex:
            # NOTE(claudiub): in case of a non-transient error, the port will
            # be processed over and over again, and will not be reported as
            # bound (e.g.: InvalidParameterValue when setting QoS), until the
            # port is deleted. These issues have to be investigated and solved
            LOG.exception("Exception encountered while processing "
                          "port %(port_id)s. Exception: %(ex)s",
                          dict(port_id=port_id, ex=ex))
        else:
            # no exception encountered, no need to reprocess.
            reprocess = False

        if reprocess:
            # Readd the port as "added", so it can be reprocessed.
            self._added_ports.add(device)

            # Force cache refresh.
            self._refresh_cache = True
            return False

        return True