diff --git a/knockoutwhistweb/app/logic/game/GameLobby.scala b/knockoutwhistweb/app/logic/game/GameLobby.scala index a43e41a..6743bdb 100644 --- a/knockoutwhistweb/app/logic/game/GameLobby.scala +++ b/knockoutwhistweb/app/logic/game/GameLobby.scala @@ -185,7 +185,7 @@ class GameLobby private( } private def getPlayerInteractable(userSession: UserSession, iType: InteractionType): AbstractPlayer = { - if (!Thread.holdsLock(userSession.lock)) { + if (!userSession.lock.isHeldByCurrentThread) { throw new IllegalStateException("The user session is not locked!") } if (userSession.canInteract.isEmpty || userSession.canInteract.get != iType) { diff --git a/knockoutwhistweb/app/model/sessions/UserSession.scala b/knockoutwhistweb/app/model/sessions/UserSession.scala index 148ed50..94e56ff 100644 --- a/knockoutwhistweb/app/model/sessions/UserSession.scala +++ b/knockoutwhistweb/app/model/sessions/UserSession.scala @@ -9,7 +9,7 @@ import java.util.concurrent.locks.{Lock, ReentrantLock} class UserSession(user: User, val host: Boolean) extends PlayerSession { var canInteract: Option[InteractionType] = None - val lock: Lock = ReentrantLock() + val lock: ReentrantLock = ReentrantLock() override def updatePlayer(event: SimpleEvent): Unit = { event match {