Avoid Array.ofDim where possible #22516

This commit is contained in:
Johan Andrén 2017-03-13 17:49:45 +01:00 committed by GitHub
parent 5ea2e0536c
commit 7a0e5b31f8
33 changed files with 74 additions and 75 deletions

View file

@ -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

View file

@ -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