mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-24 11:36:51 +01:00
Correct the concurrent initialization pattern.
This commit is contained in:
parent
7b9d971238
commit
9170e48992
@ -99,10 +99,14 @@ class PlayerSendingHandler {
|
|||||||
|
|
||||||
// Safe concurrent initialization
|
// Safe concurrent initialization
|
||||||
if (queues == null && createNew) {
|
if (queues == null && createNew) {
|
||||||
QueueContainer previous = playerSendingQueues.putIfAbsent(name, new QueueContainer());
|
final QueueContainer newContainer = new QueueContainer();
|
||||||
|
|
||||||
if (previous != null)
|
// Attempt to map the queue
|
||||||
queues = previous;
|
queues = playerSendingQueues.putIfAbsent(name, newContainer);
|
||||||
|
|
||||||
|
if (queues == null) {
|
||||||
|
queues = newContainer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for NULL again
|
// Check for NULL again
|
||||||
|
Loading…
Reference in New Issue
Block a user