Avoid Array.ofDim where possible #22516
This commit is contained in:
parent
5ea2e0536c
commit
7a0e5b31f8
33 changed files with 74 additions and 75 deletions
|
|
@ -173,10 +173,10 @@ final class LmdbDurableStore(config: Config) extends Actor with ActorLogging {
|
|||
var n = 0
|
||||
val loadData = LoadData(iter.asScala.map { entry ⇒
|
||||
n += 1
|
||||
val keyArray = Array.ofDim[Byte](entry.key.remaining)
|
||||
val keyArray = new Array[Byte](entry.key.remaining)
|
||||
entry.key.get(keyArray)
|
||||
val key = new String(keyArray, ByteString.UTF_8)
|
||||
val valArray = Array.ofDim[Byte](entry.`val`.remaining)
|
||||
val valArray = new Array[Byte](entry.`val`.remaining)
|
||||
entry.`val`.get(valArray)
|
||||
val envelope = serializer.fromBinary(valArray, manifest).asInstanceOf[DurableDataEnvelope]
|
||||
key → envelope
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ import akka.cluster.ddata.PruningState.PruningPerformed
|
|||
|
||||
private val n = new AtomicInteger(0)
|
||||
private val mask = size - 1
|
||||
private val elements = Array.ofDim[(A, B)](size)
|
||||
private val elements = new Array[(A, B)](size)
|
||||
private val ttlNanos = timeToLive.toNanos
|
||||
|
||||
// in theory this should be volatile, but since the cache has low
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue