diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index b5c5e6b0a8..179fe7e08f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -494,6 +494,9 @@ Release 2.8.0 - UNRELEASED HDFS-8292. Move conditional in fmt_time from dfs-dust.js to status.html. (Charles Lamb via wang) + HDFS-8086. Move LeaseRenewer to the hdfs.client.impl package. (Takanobu + Asanuma via szetszwo) + OPTIMIZATIONS HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java index d47992b1a5..aaba543e63 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java @@ -101,6 +101,7 @@ import org.apache.hadoop.hdfs.client.HdfsDataInputStream; import org.apache.hadoop.hdfs.client.HdfsDataOutputStream; import org.apache.hadoop.hdfs.client.impl.DfsClientConf; +import org.apache.hadoop.hdfs.client.impl.LeaseRenewer; import org.apache.hadoop.hdfs.net.Peer; import org.apache.hadoop.hdfs.net.TcpPeerServer; import org.apache.hadoop.hdfs.protocol.AclException; @@ -481,7 +482,7 @@ void endFileLease(final long inodeId) throws IOException { * enforced to consistently update its local dfsclients array and * client's filesBeingWritten map. */ - void putFileBeingWritten(final long inodeId, final DFSOutputStream out) { + public void putFileBeingWritten(final long inodeId, final DFSOutputStream out) { synchronized(filesBeingWritten) { filesBeingWritten.put(inodeId, out); // update the last lease renewal time only when there was no @@ -494,7 +495,7 @@ void putFileBeingWritten(final long inodeId, final DFSOutputStream out) { } /** Remove a file. Only called from LeaseRenewer. */ - void removeFileBeingWritten(final long inodeId) { + public void removeFileBeingWritten(final long inodeId) { synchronized(filesBeingWritten) { filesBeingWritten.remove(inodeId); if (filesBeingWritten.isEmpty()) { @@ -504,14 +505,14 @@ void removeFileBeingWritten(final long inodeId) { } /** Is file-being-written map empty? */ - boolean isFilesBeingWrittenEmpty() { + public boolean isFilesBeingWrittenEmpty() { synchronized(filesBeingWritten) { return filesBeingWritten.isEmpty(); } } /** @return true if the client is running */ - boolean isClientRunning() { + public boolean isClientRunning() { return clientRunning; } @@ -533,7 +534,7 @@ void updateLastLeaseRenewal() { * @return true if lease was renewed. May return false if this * client has been closed or has no files open. **/ - boolean renewLease() throws IOException { + public boolean renewLease() throws IOException { if (clientRunning && !isFilesBeingWrittenEmpty()) { try { namenode.renewLease(clientName); @@ -565,7 +566,7 @@ void closeConnectionToNamenode() { } /** Abort and release resources held. Ignore all errors. */ - void abort() { + public void abort() { clientRunning = false; closeAllFilesBeingWritten(true); try { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/LeaseRenewer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/client/impl/LeaseRenewer.java similarity index 94% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/LeaseRenewer.java rename to hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/client/impl/LeaseRenewer.java index 511bddb4c9..4cdf1685d6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/LeaseRenewer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/client/impl/LeaseRenewer.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hdfs; +package org.apache.hadoop.hdfs.client.impl; import java.io.IOException; import java.net.SocketTimeoutException; @@ -31,6 +31,8 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.HadoopIllegalArgumentException; import org.apache.hadoop.classification.InterfaceAudience; +import org.apache.hadoop.hdfs.DFSClient; +import org.apache.hadoop.hdfs.DFSOutputStream; import org.apache.hadoop.hdfs.protocol.HdfsConstants; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.util.Daemon; @@ -40,7 +42,7 @@ /** *

- * Used by {@link DFSClient} for renewing file-being-written leases + * Used by {@link org.apache.hadoop.hdfs.DFSClient} for renewing file-being-written leases * on the namenode. * When a file is opened for write (create or append), * namenode stores a file lease for recording the identity of the writer. @@ -53,12 +55,12 @@ * This class also provides the following functionality: *