And when client leaves, stop notifying it

@param client
client to remove
175243
@Closed(BROWSER_WATCH_SOCKET)
	public void removedClient(@Parameter("client") String client) {
		displayedControllers.inverse().remove(client);
	}
1079503
def stop(self):
        """"""
        for client in self._snippet_clients.values():
            if client.is_alive:
                self._device.log.debug('Stopping SnippetClient<%s>.',
                                       client.package)
                client.stop_app()
            else:
                self._device.log.debug(
                    'Not stopping SnippetClient<%s> because it is not alive.',
                    client.package)
224034
@FFDCIgnore(value = { InterruptedException.class })
    public void checkinClient(Client client) {
        boolean done = false;

        //If no more space. Return. Shouldn't be checking more than we have. Shouldn't happen besides unit test anyways.
        if (clients.remainingCapacity() == 0) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Checking in more clients than there should be.");
            }
            return;
        }

        while (!done) {
            try {
                //check if this client was already checked-in.
                if (!clients.contains(client)) {
                    clients.putFirst(client);
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                        int clientHash = (client != null) ? client.hashCode() : 0;
                        Tr.event(tc, "post-checkin  - (" + clientHash + ") " + (numClients - clients.remainingCapacity()) + " of " + numClients + " clients available.");
                    }
                }
                done = true;
            } catch (InterruptedException e) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    Tr.event(tc, "InterruptedException during checkin - will retry");
            }
        }

    }
973993
@Override
    public void notifyClients()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "notifyClients");

        long totalItems = getTotalMsgCount();

        synchronized (this)
        {
            if (wlmRemoved && ((_destLowMsgs == -1) || (totalItems <= _destLowMsgs)))
            {
                wlmRemoved = false;

                // re-advertise destination PUT on WLM
                if (!destinationHandler.isTemporary())
                {
                    updatePutRegistration(true);
                    destinationHandler.requestReallocation();
                }
                // Fire event if event notification is enabled
                // Also check for logging of events (510343)
                if (_isEventNotificationEnabled ||
                    (mp.getCustomProperties().getOutputLinkThresholdEventsToLog() && destinationHandler.isLink()) ||
                    (mp.getCustomProperties().getOutputDestinationThresholdEventsToLog() && !destinationHandler.isLink()))
                {
                    fireDepthThresholdReachedEvent(getControlAdapter(),
                                                   false,
                                                   totalItems, _destLowMsgs); // Reached low
                }
            }
            else if (!wlmRemoved
                     && (_destHighMsgs != -1)
                     && (_destLowMsgs != -1)
                     && (totalItems >= _destHighMsgs))
            {
                wlmRemoved = true;

                // remove destination PUT advertisement on WLM
                if (!destinationHandler.isTemporary())
                {
                    updatePutRegistration(false);
                    wlmRemoved = true;
                }
                // Fire event if event notification is enabled
                // Also check for logging of events (510343)
                if (_isEventNotificationEnabled ||
                    (mp.getCustomProperties().getOutputLinkThresholdEventsToLog() && destinationHandler.isLink()) ||
                    (mp.getCustomProperties().getOutputDestinationThresholdEventsToLog() && !destinationHandler.isLink()))
                {
                    fireDepthThresholdReachedEvent(getControlAdapter(),
                                                   true,
                                                   totalItems, _destHighMsgs); // Reached High
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "notifyClients", new Boolean(!wlmRemoved));

    }
43667
protected T removeClient(Server server) {
        T client = rxClientCache.remove(server);
        if (client != null) {
            client.shutdown();
        }
        return client;
    }
977247
private void cleanupSession(){
        eventThread.queueClientEvent(new ClientSessionEvent(SessionEvent.CLOSED));
        watcherManager.cleanup();
        session.id = "";
        session.password = null;
        session.serverId = -1;
        onSessionClose();
    }
943270
public void stop() {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Stopping client");
    }

    if (!running.compareAndSet(true, false)) {
      return;
    }
    
    synchronized (connections) {
      // wake up all connections
      for (Connection conn : connections.values()) {
        conn.interrupt();
      }
      // wait until all connections are closed
      while (!connections.isEmpty()) {
        try {
          connections.wait();
        } catch (InterruptedException e) {
          // pass
        }
      }
    }
  }
376428
@Override
	public final Promise disconnect() {
		if (client != null) {
			client.close();
			client = null;
		} else if (clusteredClient != null) {
			clusteredClient.close();
			clusteredClient = null;
		}
		return super.disconnect();
	}
1172953
@SuppressWarnings("unused")
    private void close() {
        try {
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace("Doing client selector close");
            }
            selector.close();
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace("Closed client selector");
            }
        } catch (IOException e) {
            LOGGER.warn("Ignoring exception during selector close", e);
        }
    }
645991
def close(self):
        """"""
        if not self._closed:
            self._closed = True
            self.client.close()
91168
public void leavePlace (ClientObject caller)
    {
        BodyObject body = _locator.forClient(caller);
        leaveOccupiedPlace(body);
    }
1177816
protected function closeClient(
        Net_Notifier_WebSocket_Connection $client
    ) {
        $this->log(
            sprintf(
                'closing client %s ... ',
                $client->getIPAddress()
            ),
            Net_Notifier_Logger::VERBOSITY_CLIENT
        );

        if ($client->getState() < Net_Notifier_WebSocket_Connection::STATE_CLOSED) {
            $client->close();
        }

        $key = array_search($client, $this->clients);
        unset($this->clients[$key]);

        $key = array_search($client, $this->listenClients);
        if ($key !== false) {
            unset($this->listenClients[$key]);
        }

        $this->log(
            'done' . PHP_EOL,
            Net_Notifier_Logger::VERBOSITY_CLIENT,
            false
        );
    }
591332
static void handleClientDisconnect(H2ONode client) {
    if(client != H2O.SELF) {
      if (H2O.isFlatfileEnabled()) {
        H2O.removeNodeFromFlatfile(client);
      }
      H2O.removeClient(client);
    }
  }
318525
@Override
	public void stop()
	{
		if (!started)
			return;
		
		log.info("Stopping listener ["+getName()+"]");
		
		// Close the listen socket
		multiplexer.unregisterServerSocketHandler(this);
		multiplexer.stop();
		multiplexer = null;
		
		// Close remaining clients
		closeRemainingClients();
		
		started = false;
	}
12842
def unsubscribe(self, client):
        """"""
        if client in self.clients:
            self.clients.remove(client)
            log("Unsubscribed client {} from channel {}".format(client, self.name))
329660
def disconnected(self, client):
        """"""
        if client not in self.clients:
            # already disconnected.
            return
        self.clients.remove(client)
        self._log_disconnected(client)
        self._close(client)
1309871
def remove_client(self, client_identifier):
        """"""
        new_clients = self.clients
        new_clients.remove(client_identifier)
        yield from self._server.group_clients(self.identifier, new_clients)
        _LOGGER.info('removed %s from %s', client_identifier, self.identifier)
        self._server.client(client_identifier).callback()
        self.callback()