mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-01-20 02:24:45 +00:00
Replace mutable HashMap with concurrent TrieMap to hopefully improve thread safety for inventory item operations (#441)
This commit is contained in:
parent
3f2240947b
commit
49fc029c51
|
|
@ -8,6 +8,7 @@ import net.psforever.types.PlanetSideGUID
|
|||
|
||||
import scala.annotation.tailrec
|
||||
import scala.collection.mutable
|
||||
import scala.collection.concurrent
|
||||
import scala.util.{Failure, Success, Try}
|
||||
|
||||
/**
|
||||
|
|
@ -32,7 +33,7 @@ class GridInventory extends Container {
|
|||
private var offset : Int = 0 //the effective index of the first cell in the inventory where offset >= 0
|
||||
|
||||
/* key - an integer (not especially meaningful beyond being unique); value - the card that represents the stowed item */
|
||||
private val items : mutable.HashMap[Int, InventoryItem] = mutable.HashMap[Int, InventoryItem]()
|
||||
private val items : concurrent.TrieMap[Int, InventoryItem] = concurrent.TrieMap[Int, InventoryItem]()
|
||||
private val entryIndex : AtomicInteger = new AtomicInteger(0)
|
||||
private var grid : Array[Int] = Array.fill[Int](1)(-1)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue