Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

Commit f6d056e

Browse files
committed
refactor(QueueEntryImpl): replace volatile awaitingConnection variable with AtomicBoolean for thread safety
1 parent ee4a63a commit f6d056e

File tree

1 file changed

+4
-2
lines changed
  • surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/entry

1 file changed

+4
-2
lines changed

surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/entry/QueueEntryImpl.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package dev.slne.surf.cloud.standalone.server.queue.entry
22

3+
import dev.slne.surf.cloud.api.common.util.getValue
4+
import dev.slne.surf.cloud.api.common.util.setValue
35
import dev.slne.surf.cloud.api.server.queue.QueueEntry
46
import dev.slne.surf.cloud.standalone.config.standaloneConfig
57
import java.util.*
8+
import java.util.concurrent.atomic.AtomicBoolean
69

710
data class QueueEntryImpl(
811
val handle: PlayerQueueHandle,
@@ -11,8 +14,7 @@ data class QueueEntryImpl(
1114
override val bypassQueue: Boolean,
1215
override val preferredServerUid: Long? = null,
1316
) : QueueEntry {
14-
@Volatile
15-
override var awaitingConnection = false
17+
override var awaitingConnection by AtomicBoolean()
1618
override var connectionAttempts = 0
1719

1820
override fun hasConnectionAttemptsLeft() =

0 commit comments

Comments
 (0)