All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jizcode.netty.server.ClientCollection Maven / Gradle / Ivy

package jizcode.netty.server;

import java.util.ArrayList;
import java.util.List;

import io.netty.channel.Channel;

public class ClientCollection {
    private List clients = new ArrayList();

    public List getClients(){
        return clients;
    }

    public Client getClient(String id){
        for (Client client : clients) {
            if(client.getId() != null && client.getId().equals(id)){
                return client;
            }
        }
        return null;
    }

    public void saveClient(String id, Channel channel){
        for (Client client : clients) {
            if(client.getId() != null && client.getId().equals(id)){
                client.setChannel(channel);
                return;
            }
        }
        clients.add(new Client(id, channel));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy