protected Status readStatus() throws InterruptedException, IOException {
  final File statusFile=new File(workingDir,statusName);
  FileInputStream fileInput=null;
  ObjectInputStream objectInput=null;
  try {
    fileInput=new FileInputStream(statusFile);
    objectInput=new ObjectInputStream(fileInput);
    Status status=(Status)objectInput.readObject();
    if (!isExistingProcess(status.pid)) {
      status=createStatus(this.baseName,SHUTDOWN,status.pid);
    }
    return status;
  }
 catch (  ClassNotFoundException e) {
    throw new RuntimeException(e);
  }
catch (  FileNotFoundException e) {
    Thread.sleep(500);
    if (statusFile.exists()) {
      return readStatus();
    }
 else {
      throw e;
    }
  }
 finally {
    IOUtils.close(objectInput);
    IOUtils.close(fileInput);
  }
}

protected Status readStatus ( ) throws InterruptedException , IOException { final File statusFile = new File ( workingDir , statusName ) ; FileInputStream fileInput = null ; ObjectInputStream objectInput = null ; try { fileInput = new FileInputStream ( statusFile ) ; objectInput = new ObjectInputStream ( fileInput ) ; Status status = ( Status ) objectInput . readObject ( ) ; if ( ! isExistingProcess ( status . pid ) ) { status = createStatus ( this . baseName , SHUTDOWN , status . pid ) ; } return status ; } catch ( ClassNotFoundException e ) { throw new RuntimeException ( e ) ; } catch ( FileNotFoundException e ) { Thread . sleep ( 500 ) ; if ( statusFile . exists ( ) ) { return readStatus ( ) ; } else { throw e ; } } finally { IOUtils . close ( objectInput ) ; IOUtils . close ( fileInput ) ; } }
reads a cache server ' s status from a file in its working directory .
