当前位置: 首页>>代码示例>>Java>>正文


Java Lease.expiredSoftLimit方法代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.server.namenode.LeaseManager.Lease.expiredSoftLimit方法的典型用法代码示例。如果您正苦于以下问题:Java Lease.expiredSoftLimit方法的具体用法?Java Lease.expiredSoftLimit怎么用?Java Lease.expiredSoftLimit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hdfs.server.namenode.LeaseManager.Lease的用法示例。


在下文中一共展示了Lease.expiredSoftLimit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: recoverLeaseInternal

import org.apache.hadoop.hdfs.server.namenode.LeaseManager.Lease; //导入方法依赖的package包/类
private boolean recoverLeaseInternal(INode fileInode,
    String src, String holder, String clientMachine, boolean force,
    boolean discardLastBlock)
throws IOException {
  if (fileInode != null && fileInode.isUnderConstruction()) {
    INodeFileUnderConstruction pendingFile = (INodeFileUnderConstruction) fileInode;
    //
    // If the file is under construction , then it must be in our
    // leases. Find the appropriate lease record.
    //
    Lease lease = leaseManager.getLease(holder);
    //
    // We found the lease for this file. And surprisingly the original
    // holder is trying to recreate this file. This should never occur.
    //
    if (!force && lease != null) {
      Lease leaseFile = leaseManager.getLeaseByPath(src);
      if (leaseFile != null && leaseFile.equals(lease)) {
        // do not change message in this exception
        // failover client relies on this message
        throw new AlreadyBeingCreatedException(
                  "failed to create file " + src + " for " + holder +
                  " on client " + clientMachine +
                  " because current leaseholder is trying to recreate file.");
      }
    }
    //
    // Find the original holder.
    //
    lease = leaseManager.getLease(pendingFile.clientName);
    if (lease == null) {
      throw new AlreadyBeingCreatedException(
                  "failed to create file " + src + " for " + holder +
                  " on client " + clientMachine +
                  " because pendingCreates is non-null but no leases found.");
    }
    if (force) {
      // close now: no need to wait for soft lease expiration and
      // close only the file src
      LOG.info("recoverLease: recover lease " + lease + ", src=" + src +
               " from client " + pendingFile.clientName +
               " discardLastBloc = " + discardLastBlock);
      // We have to tell the client that the lease recovery has succeeded e.g. in case the file
      // has no blocks. Otherwise, the client will get stuck in an infinite loop.
      return internalReleaseLeaseOne(lease, src, pendingFile, discardLastBlock);
    } else {
      //
      // If the original holder has not renewed in the last SOFTLIMIT
      // period, then start lease recovery.
      //
      if (lease.expiredSoftLimit()) {
        LOG.info("startFile: recover lease " + lease + ", src=" + src +
            " from client " + pendingFile.clientName);
        internalReleaseLease(lease, src, pendingFile);
      }
      throw new AlreadyBeingCreatedException(
          "failed to create file " + src + " for " + holder +
          " on client " + clientMachine +
          ", because this file is already being created by " +
          pendingFile.getClientName() +
          " on " + pendingFile.getClientMachine());
    }
  }
  // This does not necessarily mean lease recovery has failed, but we will
  // have the client retry.
  return false;
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:68,代码来源:FSNamesystem.java

示例2: recoverLeaseInternal

import org.apache.hadoop.hdfs.server.namenode.LeaseManager.Lease; //导入方法依赖的package包/类
private void recoverLeaseInternal(INode fileInode, 
    String src, String holder, String clientMachine, boolean force)
throws IOException {
  if (fileInode != null && fileInode.isUnderConstruction()) {
    INodeFileUnderConstruction pendingFile = (INodeFileUnderConstruction) fileInode;
    //
    // If the file is under construction , then it must be in our
    // leases. Find the appropriate lease record.
    //
    Lease lease = leaseManager.getLease(holder);
    //
    // We found the lease for this file. And surprisingly the original
    // holder is trying to recreate this file. This should never occur.
    //
    if (!force && lease != null) {
      Lease leaseFile = leaseManager.getLeaseByPath(src);
      if (leaseFile != null && leaseFile.equals(lease)) { 
        throw new AlreadyBeingCreatedException(
                  "failed to create file " + src + " for " + holder +
                  " on client " + clientMachine + 
                  " because current leaseholder is trying to recreate file.");
      }
    }
    //
    // Find the original holder.
    //
    lease = leaseManager.getLease(pendingFile.clientName);
    if (lease == null) {
      throw new AlreadyBeingCreatedException(
                  "failed to create file " + src + " for " + holder +
                  " on client " + clientMachine + 
                  " because pendingCreates is non-null but no leases found.");
    }
    if (force) {
      // close now: no need to wait for soft lease expiration and 
      // close only the file src
      LOG.info("recoverLease: recover lease " + lease + ", src=" + src +
               " from client " + pendingFile.clientName);
      internalReleaseLeaseOne(lease, src);
    } else {
      //
      // If the original holder has not renewed in the last SOFTLIMIT 
      // period, then start lease recovery.
      //
      if (lease.expiredSoftLimit()) {
        LOG.info("startFile: recover lease " + lease + ", src=" + src +
            " from client " + pendingFile.clientName);
        internalReleaseLease(lease, src);
      }
      throw new AlreadyBeingCreatedException(
          "failed to create file " + src + " for " + holder +
          " on client " + clientMachine + 
          ", because this file is already being created by " +
          pendingFile.getClientName() + 
          " on " + pendingFile.getClientMachine());
    }
  }

}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:60,代码来源:FSNamesystem.java

示例3: recoverLeaseInternal

import org.apache.hadoop.hdfs.server.namenode.LeaseManager.Lease; //导入方法依赖的package包/类
private boolean recoverLeaseInternal(INode fileInode,
    String src, String holder, String clientMachine, boolean force,
    boolean discardLastBlock)
throws IOException {
  if (fileInode != null && fileInode.isUnderConstruction()) {
    INodeFileUnderConstruction pendingFile = (INodeFileUnderConstruction) fileInode;
    //
    // If the file is under construction , then it must be in our
    // leases. Find the appropriate lease record.
    //
    Lease lease = leaseManager.getLease(holder);
    //
    // We found the lease for this file. And surprisingly the original
    // holder is trying to recreate this file. This should never occur.
    //
    if (!force && lease != null) {
      Lease leaseFile = leaseManager.getLeaseByPath(src);
      if (leaseFile != null && leaseFile.equals(lease)) {
        throw new AlreadyBeingCreatedException(
                  "failed to create file " + src + " for " + holder +
                  " on client " + clientMachine +
                  " because current leaseholder is trying to recreate file.");
      }
    }
    //
    // Find the original holder.
    //
    lease = leaseManager.getLease(pendingFile.clientName);
    if (lease == null) {
      throw new AlreadyBeingCreatedException(
                  "failed to create file " + src + " for " + holder +
                  " on client " + clientMachine +
                  " because pendingCreates is non-null but no leases found.");
    }
    if (force) {
      // close now: no need to wait for soft lease expiration and
      // close only the file src
      LOG.info("recoverLease: recover lease " + lease + ", src=" + src +
               " from client " + pendingFile.clientName +
               " discardLastBloc = " + discardLastBlock);
      // We have to tell the client that the lease recovery has succeeded e.g. in case the file
      // has no blocks. Otherwise, the client will get stuck in an infinite loop.
      return internalReleaseLeaseOne(lease, src, pendingFile, discardLastBlock);
    } else {
      //
      // If the original holder has not renewed in the last SOFTLIMIT
      // period, then start lease recovery.
      //
      if (lease.expiredSoftLimit()) {
        LOG.info("startFile: recover lease " + lease + ", src=" + src +
            " from client " + pendingFile.clientName);
        internalReleaseLease(lease, src, pendingFile);
      }
      throw new AlreadyBeingCreatedException(
          "failed to create file " + src + " for " + holder +
          " on client " + clientMachine +
          ", because this file is already being created by " +
          pendingFile.getClientName() +
          " on " + pendingFile.getClientMachine());
    }
  }
  // This does not necessarily mean lease recovery has failed, but we will
  // have the client retry.
  return false;
}
 
开发者ID:iVCE,项目名称:RDFS,代码行数:66,代码来源:FSNamesystem.java


注:本文中的org.apache.hadoop.hdfs.server.namenode.LeaseManager.Lease.expiredSoftLimit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。