private Map<Integer, IMappedPage[]> testAndGetSharedMap(IMappedPageFactory pageFactory, int threadNum, int pageNumLimit) {
		
		// init shared map
		Map<Integer, IMappedPage[]> sharedMap = new ConcurrentHashMap<Integer, IMappedPage[]>();
		for(int i = 0; i < threadNum; i++) {
			IMappedPage[] pageArray = new IMappedPage[pageNumLimit];
			sharedMap.put(i, pageArray);
		}
		
		// init threads and start
		CountDownLatch latch = new CountDownLatch(threadNum);
		Worker[] workers = new Worker[threadNum];
		for(int i = 0; i < threadNum; i++) {
			workers[i] = new Worker(i, sharedMap, mappedPageFactory, pageNumLimit, latch);
			workers[i].start();
		}
		
		// wait to finish
		for(int i = 0; i < threadNum; i++) {
			try {
				workers[i].join();
			} catch (InterruptedException e) {
				// ignore silently
			}
		}
		
		// validate
		IMappedPage[] firstPageArray = sharedMap.get(0);
		for(int j = 0; j < pageNumLimit; j++) {
			IMappedPage page = firstPageArray[j];
			assertTrue(!page.isClosed());
		}
		for(int i = 1; i < threadNum; i++) {
			IMappedPage[] pageArray = sharedMap.get(i);
			for(int j = 0; j < pageNumLimit; j++) {
				assertSame(firstPageArray[j], pageArray[j]);
			}
		}
		
		return sharedMap;
	}