ReplicaMap { void mergeAll(ReplicaMap other) { other.map.forEach( (bp, replicaInfos) -> { replicaInfos.forEach( replicaInfo -> add(bp, replicaInfo) ); } ); } ReplicaMap(AutoCloseableLock readLock, AutoCloseableLock writeLock);   ReplicaMap(ReadWriteLock lock);   }
@Test public void testMergeAll() { ReplicaMap temReplicaMap = new ReplicaMap(new ReentrantReadWriteLock()); Block tmpBlock = new Block(5678, 5678, 5678); temReplicaMap.add(bpid, new FinalizedReplica(tmpBlock, null, null)); map.mergeAll(temReplicaMap); assertNotNull(map.get(bpid, 1234)); assertNotNull(map.get(bpid, 5678)); }