private void setDirInternal(File dir) { if (dir == null) { baseDir = null; return; } ReplicaDirInfo dirInfo = parseBaseDir(dir); this.hasSubdirs = dirInfo.hasSubidrs; synchronized (internedBaseDirs) { if (!internedBaseDirs.containsKey(dirInfo.baseDirPath)) { // Create a new String path of this file and make a brand new File object // to guarantee we drop the reference to the underlying char[] storage. File baseDir = new File(dirInfo.baseDirPath); internedBaseDirs.put(dirInfo.baseDirPath, baseDir); } this.baseDir = internedBaseDirs.get(dirInfo.baseDirPath); } }
private void setDirInternal(File dir) { if (dir == null) { baseDir = null; return; } ReplicaDirInfo dirInfo = parseBaseDir(dir); this.hasSubdirs = dirInfo.hasSubidrs; synchronized (internedBaseDirs) { if (!internedBaseDirs.containsKey(dirInfo.baseDirPath)) { // Create a new String path of this file and make a brand new File object // to guarantee we drop the reference to the underlying char[] storage. File baseDir = new File(dirInfo.baseDirPath); internedBaseDirs.put(dirInfo.baseDirPath, baseDir); } this.baseDir = internedBaseDirs.get(dirInfo.baseDirPath); } }