i besoin d'un fil carte sûr, j'ai quelque chose comme ceci: (je suis très nouveau pour Java)fil carte sécurité pour Java
public static class Manager
{
static
{
//something wrong here, doesn't compile
list = new java.util.Collections
.synchronizedMap(new Map<String, Client>());
}
static Map<String,Client> list;
public static void AddClient(Client client)
{
// thread safe add client to the list
}
public static void RemoveClient(Client client)
{
// thread safe remove client to the list
}
}
Notez mutables sont statics vraiment, vraiment, vraiment mauvaise idée. –