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


Java RemoteException.unwrapRemoteException方法代码示例

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


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

示例1: removeAclEntries

import org.apache.hadoop.ipc.RemoteException; //导入方法依赖的package包/类
public void removeAclEntries(String src, List<AclEntry> aclSpec)
    throws IOException {
  checkOpen();
  TraceScope scope = Trace.startSpan("removeAclEntries", traceSampler);
  try {
    namenode.removeAclEntries(src, aclSpec);
  } catch(RemoteException re) {
    throw re.unwrapRemoteException(AccessControlException.class,
                                   AclException.class,
                                   FileNotFoundException.class,
                                   NSQuotaExceededException.class,
                                   SafeModeException.class,
                                   SnapshotAccessControlException.class,
                                   UnresolvedPathException.class);
  } finally {
    scope.close();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:DFSClient.java

示例2: listPaths

import org.apache.hadoop.ipc.RemoteException; //导入方法依赖的package包/类
/**
 * Used by readdir and readdirplus to get dirents. It retries the listing if
 * the startAfter can't be found anymore.
 */
private DirectoryListing listPaths(DFSClient dfsClient, String dirFileIdPath,
    byte[] startAfter) throws IOException {
  DirectoryListing dlisting;
  try {
    dlisting = dfsClient.listPaths(dirFileIdPath, startAfter);
  } catch (RemoteException e) {
    IOException io = e.unwrapRemoteException();
    if (!(io instanceof DirectoryListingStartAfterNotFoundException)) {
      throw io;
    }
    // This happens when startAfter was just deleted
    LOG.info("Cookie couldn't be found: "
        + new String(startAfter, Charset.forName("UTF-8"))
        + ", do listing from beginning");
    dlisting = dfsClient
        .listPaths(dirFileIdPath, HdfsFileStatus.EMPTY_NAME);
  }
  return dlisting;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:RpcProgramNfs3.java

示例3: createSymlink

import org.apache.hadoop.ipc.RemoteException; //导入方法依赖的package包/类
/**
 * Creates a symbolic link.
 * 
 * @see ClientProtocol#createSymlink(String, String,FsPermission, boolean) 
 */
public void createSymlink(String target, String link, boolean createParent)
    throws IOException {
  TraceScope scope = getPathTraceScope("createSymlink", target);
  try {
    FsPermission dirPerm = 
        FsPermission.getDefault().applyUMask(dfsClientConf.uMask); 
    namenode.createSymlink(target, link, dirPerm, createParent);
  } catch (RemoteException re) {
    throw re.unwrapRemoteException(AccessControlException.class,
                                   FileAlreadyExistsException.class, 
                                   FileNotFoundException.class,
                                   ParentNotDirectoryException.class,
                                   NSQuotaExceededException.class, 
                                   DSQuotaExceededException.class,
                                   UnresolvedPathException.class,
                                   SnapshotAccessControlException.class);
  } finally {
    scope.close();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:DFSClient.java

示例4: setTimes

import org.apache.hadoop.ipc.RemoteException; //导入方法依赖的package包/类
/**
 * set the modification and access time of a file
 * 
 * @see ClientProtocol#setTimes(String, long, long)
 */
public void setTimes(String src, long mtime, long atime) throws IOException {
  checkOpen();
  TraceScope scope = getPathTraceScope("setTimes", src);
  try {
    namenode.setTimes(src, mtime, atime);
  } catch(RemoteException re) {
    throw re.unwrapRemoteException(AccessControlException.class,
                                   FileNotFoundException.class,
                                   UnresolvedPathException.class,
                                   SnapshotAccessControlException.class);
  } finally {
    scope.close();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:DFSClient.java

示例5: callInitReplicaRecovery

import org.apache.hadoop.ipc.RemoteException; //导入方法依赖的package包/类
/**
 * Convenience method, which unwraps RemoteException.
 * @throws IOException not a RemoteException.
 */
private static ReplicaRecoveryInfo callInitReplicaRecovery(
    InterDatanodeProtocol datanode,
    RecoveringBlock rBlock) throws IOException {
  try {
    return datanode.initReplicaRecovery(rBlock);
  } catch(RemoteException re) {
    throw re.unwrapRemoteException();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:DataNode.java

示例6: allowSnapshot

import org.apache.hadoop.ipc.RemoteException; //导入方法依赖的package包/类
/**
 * Allow snapshot on a directory.
 * 
 * @see ClientProtocol#allowSnapshot(String snapshotRoot)
 */
public void allowSnapshot(String snapshotRoot) throws IOException {
  checkOpen();
  TraceScope scope = Trace.startSpan("allowSnapshot", traceSampler);
  try {
    namenode.allowSnapshot(snapshotRoot);
  } catch (RemoteException re) {
    throw re.unwrapRemoteException();
  } finally {
    scope.close();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:DFSClient.java

示例7: saveNamespace

import org.apache.hadoop.ipc.RemoteException; //导入方法依赖的package包/类
/**
 * Save namespace image.
 * 
 * @see ClientProtocol#saveNamespace()
 */
void saveNamespace() throws AccessControlException, IOException {
  TraceScope scope = Trace.startSpan("saveNamespace", traceSampler);
  try {
    namenode.saveNamespace();
  } catch(RemoteException re) {
    throw re.unwrapRemoteException(AccessControlException.class);
  } finally {
    scope.close();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:DFSClient.java

示例8: findException

import org.apache.hadoop.ipc.RemoteException; //导入方法依赖的package包/类
/**
 * Look for an exception we know in the remote exception:
 * - hadoop.ipc wrapped exceptions
 * - nested exceptions
 *
 * Looks for: RegionMovedException / RegionOpeningException / RegionTooBusyException /
 *            ThrottlingException
 * @return null if we didn't find the exception, the exception otherwise.
 */
public static Throwable findException(Object exception) {
  if (exception == null || !(exception instanceof Throwable)) {
    return null;
  }
  Throwable cur = (Throwable) exception;
  while (cur != null) {
    if (isSpecialException(cur)) {
      return cur;
    }
    if (cur instanceof RemoteException) {
      RemoteException re = (RemoteException) cur;
      cur = re.unwrapRemoteException(
          RegionOpeningException.class, RegionMovedException.class,
          RegionTooBusyException.class);
      if (cur == null) {
        cur = re.unwrapRemoteException();
      }
      // unwrapRemoteException can return the exception given as a parameter when it cannot
      //  unwrap it. In this case, there is no need to look further
      // noinspection ObjectEquality
      if (cur == re) {
        return cur;
      }
    } else if (cur.getCause() != null) {
      cur = cur.getCause();
    } else {
      return cur;
    }
  }

  return null;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:42,代码来源:ClientExceptionsUtil.java

示例9: concat

import org.apache.hadoop.ipc.RemoteException; //导入方法依赖的package包/类
/**
 * Move blocks from src to trg and delete src
 * See {@link ClientProtocol#concat}.
 */
public void concat(String trg, String [] srcs) throws IOException {
  checkOpen();
  TraceScope scope = Trace.startSpan("concat", traceSampler);
  try {
    namenode.concat(trg, srcs);
  } catch(RemoteException re) {
    throw re.unwrapRemoteException(AccessControlException.class,
                                   UnresolvedPathException.class,
                                   SnapshotAccessControlException.class);
  } finally {
    scope.close();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:DFSClient.java

示例10: getSnapshotDiffReport

import org.apache.hadoop.ipc.RemoteException; //导入方法依赖的package包/类
/**
 * Get the difference between two snapshots, or between a snapshot and the
 * current tree of a directory.
 * @see ClientProtocol#getSnapshotDiffReport(String, String, String)
 */
public SnapshotDiffReport getSnapshotDiffReport(String snapshotDir,
    String fromSnapshot, String toSnapshot) throws IOException {
  checkOpen();
  TraceScope scope = Trace.startSpan("getSnapshotDiffReport", traceSampler);
  try {
    return namenode.getSnapshotDiffReport(snapshotDir,
        fromSnapshot, toSnapshot);
  } catch(RemoteException re) {
    throw re.unwrapRemoteException();
  } finally {
    scope.close();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:DFSClient.java

示例11: deleteSnapshot

import org.apache.hadoop.ipc.RemoteException; //导入方法依赖的package包/类
/**
 * Delete a snapshot of a snapshottable directory.
 * 
 * @param snapshotRoot The snapshottable directory that the 
 *                    to-be-deleted snapshot belongs to
 * @param snapshotName The name of the to-be-deleted snapshot
 * @throws IOException
 * @see ClientProtocol#deleteSnapshot(String, String)
 */
public void deleteSnapshot(String snapshotRoot, String snapshotName)
    throws IOException {
  checkOpen();
  TraceScope scope = Trace.startSpan("deleteSnapshot", traceSampler);
  try {
    namenode.deleteSnapshot(snapshotRoot, snapshotName);
  } catch(RemoteException re) {
    throw re.unwrapRemoteException();
  } finally {
    scope.close();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:DFSClient.java

示例12: getAclStatus

import org.apache.hadoop.ipc.RemoteException; //导入方法依赖的package包/类
public AclStatus getAclStatus(String src) throws IOException {
  checkOpen();
  TraceScope scope = getPathTraceScope("getAclStatus", src);
  try {
    return namenode.getAclStatus(src);
  } catch(RemoteException re) {
    throw re.unwrapRemoteException(AccessControlException.class,
                                   AclException.class,
                                   FileNotFoundException.class,
                                   UnresolvedPathException.class);
  } finally {
    scope.close();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:DFSClient.java

示例13: renew

import org.apache.hadoop.ipc.RemoteException; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public long renew(Token<?> token, Configuration conf) throws IOException {
  Token<DelegationTokenIdentifier> delToken = 
    (Token<DelegationTokenIdentifier>) token;
  ClientProtocol nn = getNNProxy(delToken, conf);
  try {
    return nn.renewDelegationToken(delToken);
  } catch (RemoteException re) {
    throw re.unwrapRemoteException(InvalidToken.class, 
                                   AccessControlException.class);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:DFSClient.java

示例14: cancel

import org.apache.hadoop.ipc.RemoteException; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void cancel(Token<?> token, Configuration conf) throws IOException {
  Token<DelegationTokenIdentifier> delToken = 
      (Token<DelegationTokenIdentifier>) token;
  LOG.info("Cancelling " + 
           DelegationTokenIdentifier.stringifyToken(delToken));
  ClientProtocol nn = getNNProxy(delToken, conf);
  try {
    nn.cancelDelegationToken(delToken);
  } catch (RemoteException re) {
    throw re.unwrapRemoteException(InvalidToken.class,
        AccessControlException.class);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:DFSClient.java

示例15: callGetBlockLocations

import org.apache.hadoop.ipc.RemoteException; //导入方法依赖的package包/类
/**
 * @see ClientProtocol#getBlockLocations(String, long, long)
 */
static LocatedBlocks callGetBlockLocations(ClientProtocol namenode,
    String src, long start, long length) 
    throws IOException {
  try {
    return namenode.getBlockLocations(src, start, length);
  } catch(RemoteException re) {
    throw re.unwrapRemoteException(AccessControlException.class,
                                   FileNotFoundException.class,
                                   UnresolvedPathException.class);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:DFSClient.java


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