Thread Safe Map für Java

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Thread Safe Map für Java

by Anonymous » 17 Mar 2025, 00:28

Ich brauche eine Thread -Safe -Karte, ich habe so etwas: (Ich bin sehr neu in Java) < /p>

Code: Select all

 public static class Manager
{
static
{
//something wrong here, doesn't compile
list = new java.util.Collections
.synchronizedMap(new Map());
}

static Map 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
}

}

Top