synchronized void removeLeaseWithPrefixPath(String prefix) throws IOException { for(Map.Entry<String, Lease> entry : findLeaseWithPrefixPath(prefix, sortedLeasesByPath)) { if (LOG.isDebugEnabled()) { LOG.debug(LeaseManager.class.getSimpleName() + ".removeLeaseWithPrefixPath: entry=" + entry); } removeLease(entry.getValue(), entry.getKey()); } }
synchronized void removeLeaseWithPrefixPath(String prefix) { for(Map.Entry<String, Lease> entry : findLeaseWithPrefixPath(prefix, sortedLeasesByPath).entrySet()) { if (LOG.isDebugEnabled()) { LOG.debug(LeaseManager.class.getSimpleName() + ".removeLeaseWithPrefixPath: entry=" + entry); } removeLease(entry.getValue(), entry.getKey()); } }
synchronized void removeLeaseWithPrefixPath(String prefix) { for(Map.Entry<String, LeaseOpenTime> entry : findLeaseWithPrefixPath(prefix, sortedLeasesByPath)) { if (LOG.isDebugEnabled()) { LOG.debug(LeaseManager.class.getSimpleName() + ".removeLeaseWithPrefixPath: entry=" + entry); } removeLease(entry.getValue().lease, entry.getKey()); } }
synchronized void changeLease(String src, String dst, String overwrite, String replaceBy) { if (LOG.isDebugEnabled()) { LOG.debug(getClass().getSimpleName() + ".changelease: " + " src=" + src + ", dest=" + dst + ", overwrite=" + overwrite + ", replaceBy=" + replaceBy); } final int len = overwrite.length(); for(Map.Entry<String, LeaseOpenTime> entry : findLeaseWithPrefixPath(src, sortedLeasesByPath)) { final String oldpath = entry.getKey(); final Lease lease = entry.getValue().lease; //overwrite must be a prefix of oldpath final String newpath = replaceBy + oldpath.substring(len); if (LOG.isDebugEnabled()) { LOG.debug("changeLease: replacing " + oldpath + " with " + newpath); } lease.replacePath(oldpath, newpath); LeaseOpenTime openTime = sortedLeasesByPath.remove(oldpath); sortedLeasesByPath.put(newpath, openTime); } }
synchronized void removeLeaseWithPrefixPath(String prefix) { for(Map.Entry<String, Lease> entry : findLeaseWithPrefixPath(prefix, sortedLeasesByPath).entrySet()) { if (LOG.isDebugEnabled()) { LOG.debug(LeaseManager.class.getSimpleName() + ".removeLeaseWithPrefixPath: entry=" + entry); } removeLease(entry.getValue(), entry.getKey()); } }
synchronized void changeLease(String src, String dst) { if (LOG.isDebugEnabled()) { LOG.debug(getClass().getSimpleName() + ".changelease: " + " src=" + src + ", dest=" + dst); } final int len = src.length(); for(Map.Entry<String, Lease> entry : findLeaseWithPrefixPath(src, sortedLeasesByPath).entrySet()) { final String oldpath = entry.getKey(); final Lease lease = entry.getValue(); // replace stem of src with new destination final String newpath = dst + oldpath.substring(len); if (LOG.isDebugEnabled()) { LOG.debug("changeLease: replacing " + oldpath + " with " + newpath); } lease.replacePath(oldpath, newpath); sortedLeasesByPath.remove(oldpath); sortedLeasesByPath.put(newpath, lease); } }
synchronized void changeLease(String src, String dst, String overwrite, String replaceBy) throws IOException { if (LOG.isDebugEnabled()) { LOG.debug(getClass().getSimpleName() + ".changelease: " + " src=" + src + ", dest=" + dst + ", overwrite=" + overwrite + ", replaceBy=" + replaceBy); } for(Map.Entry<String, Lease> entry : findLeaseWithPrefixPath(src, sortedLeasesByPath)) { final String oldpath = entry.getKey(); final Lease lease = entry.getValue(); final String newpath = oldpath.replaceFirst( java.util.regex.Pattern.quote(overwrite), replaceBy); if (LOG.isDebugEnabled()) { LOG.debug("changeLease: replacing " + oldpath + " with " + newpath); } lease.replacePath(oldpath, newpath); sortedLeasesByPath.remove(oldpath); sortedLeasesByPath.put(newpath, lease); } }
synchronized void changeLease(String src, String dst) { if (LOG.isDebugEnabled()) { LOG.debug(getClass().getSimpleName() + ".changelease: " + " src=" + src + ", dest=" + dst); } final int len = src.length(); for(Map.Entry<String, Lease> entry : findLeaseWithPrefixPath(src, sortedLeasesByPath).entrySet()) { final String oldpath = entry.getKey(); final Lease lease = entry.getValue(); // replace stem of src with new destination final String newpath = dst + oldpath.substring(len); if (LOG.isDebugEnabled()) { LOG.debug("changeLease: replacing " + oldpath + " with " + newpath); } lease.replacePath(oldpath, newpath); sortedLeasesByPath.remove(oldpath); sortedLeasesByPath.put(newpath, lease); } }