hadoop-hdfs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 周杰 <zhoujie...@126.com>
Subject A question about LeaseChecker
Date Sat, 24 Sep 2011 05:36:20 GMT
    Hi,glad to meet you.
    I am a beginner of Hadoop.
Yestory I saw the HDFS-1840 ,which said:
In DFSClient, when there are files opened for write, a LeaseChecker thread is started for
updating the leases periodically. However, it never terminates when when all writing files
are closed.
But I am a little confused. why it never the leasechecker thread.

I have seen the source of LeaseChecker,and its run():
  public void run() {
      while (clientRunning && !Thread.interrupted()) {
        try {
        } catch (InterruptedException ie) {

that is to say ,when the clientRunning is false or we call its interrupted() ,the thread will
exit the while loop and then terminate the thread.
Next,I have seen the DFSClient's  function close():
 public synchronized void close() throws IOException {
    if(clientRunning) {
     clientRunning = false;
      try {
      } catch (InterruptedException ie) {
      // close connections to the namenode


Obviously , if calling the close() ,the variable "clientRunning" will become false and  the
leasechecker.interruptAndJoin() will call the daemon's  interrupted() , which means  that
 the LeaseChecker will terminate  at last.
Besides ,when all the writing files are closed ,the FileSystem will call the DFSClient's close(),
so my question is why the HDFS-1840 says the LeaseChecker will never teminate ?

Best Regards,
View raw message