Archiviert
13
0

Correct the concurrent initialization pattern.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2012-11-20 03:32:44 +01:00
Ursprung 7b9d971238
Commit 9170e48992

Datei anzeigen

@ -99,10 +99,14 @@ class PlayerSendingHandler {
// Safe concurrent initialization
if (queues == null && createNew) {
QueueContainer previous = playerSendingQueues.putIfAbsent(name, new QueueContainer());
final QueueContainer newContainer = new QueueContainer();
if (previous != null)
queues = previous;
// Attempt to map the queue
queues = playerSendingQueues.putIfAbsent(name, newContainer);
if (queues == null) {
queues = newContainer;
}
}
// Check for NULL again