@VisibleForTesting
  synchronized void writeDelegationTokenToFile() throws IOException {
    if (this.fs.exists(this.tokenFilePath)) {
      LOGGER.info("Deleting existing token file " + this.tokenFilePath);
      this.fs.delete(this.tokenFilePath, false);
    }

    LOGGER.info("Writing new or renewed token to token file " + this.tokenFilePath);
    YarnHelixUtils.writeTokenToFile(this.token, this.tokenFilePath, this.fs.getConf());
    // Only grand access to the token file to the login user
    this.fs.setPermission(this.tokenFilePath, new FsPermission(FsAction.READ_WRITE, FsAction.NONE, FsAction.NONE));
  }
@ VisibleForTesting synchronized void writeDelegationTokenToFile ( ) throws IOException { if ( this . fs . exists ( this . tokenFilePath ) ) { LOGGER . info ( "Deleting existing token file " + this . tokenFilePath ) ; this . fs . delete ( this . tokenFilePath , false ) ; } LOGGER . info ( "Writing new or renewed token to token file " + this . tokenFilePath ) ; YarnHelixUtils . writeTokenToFile ( this . token , this . tokenFilePath , this . fs . getConf ( ) ) ; this . fs . setPermission ( this . tokenFilePath , new FsPermission ( FsAction . READ_WRITE , FsAction . NONE , FsAction . NONE ) ) ; }
Write the current delegation token to the token file.