wsky / top-push

Message-push abstraction component, provide useful messaging components.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cleanConnections should log them

wsky opened this issue · comments

protected synchronized void RemoveConnection(ClientConnection conn) {
        this.connections.remove(conn);
        this.logger.info("client#%s remove a connection from %s",
                this.getId(), conn.getOrigin());
    }

    protected synchronized int cleanConnections() {
        List<ClientConnection> trash = new ArrayList<ClientConnection>();
        Iterator<ClientConnection> iterator = this.connections.iterator();
        while (iterator.hasNext()) {
            ClientConnection clientConnection = iterator.next();
            if (!clientConnection.isOpen())
                trash.add(clientConnection);
        }
        this.connections.removeAll(trash);
        return this.connections.size();
    }

this.connections.removeAll(trash); should change to use RemoveConnection