ReferenceMap<String, MemoryMappedDocumentTable> cache = _remoteDoctblCache;
if(cache == null) {
cache = new ReferenceMap<String, MemoryMappedDocumentTable>(ReferenceType.STRONG, ReferenceType.SOFT);
_remoteDoctblCache = cache;
}
MemoryMappedDocumentTable prevDoctbl = cache.putIfAbsent(docId, mmDoctbl);
if(prevDoctbl != null) {
mmDoctbl.setBufferPool(prevDoctbl.getBufferPool());
} else {
File tmpDir = (TMP_DATA_DIR == null) ? null : new File(TMP_DATA_DIR);
String docname = FileUtils.basename(docId);
File tmpFile = File.createTempFile(docname, ".tmp", tmpDir);
tmpFile.deleteOnExit();