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


Java RpcReply类代码示例

本文整理汇总了Java中org.apache.hadoop.oncrpc.RpcReply的典型用法代码示例。如果您正苦于以下问题:Java RpcReply类的具体用法?Java RpcReply怎么用?Java RpcReply使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: messageReceived

import org.apache.hadoop.oncrpc.RpcReply; //导入依赖的package包/类
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
  // Get handle from create response
  ChannelBuffer buf = (ChannelBuffer) e.getMessage();
  XDR rsp = new XDR(buf.array());
  if (rsp.getBytes().length == 0) {
    LOG.info("rsp length is zero, why?");
    return;
  }
  LOG.info("rsp length=" + rsp.getBytes().length);

  RpcReply reply = RpcReply.read(rsp);
  int xid = reply.getXid();
  // Only process the create response
  if (xid != 0x8000004c) {
    return;
  }
  int status = rsp.readInt();
  if (status != Nfs3Status.NFS3_OK) {
    LOG.error("Create failed, status =" + status);
    return;
  }
  LOG.info("Create succeeded");
  rsp.readBoolean(); // value follow
  handle = new FileHandle();
  handle.deserialize(rsp);
  channel = e.getChannel();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:TestOutOfOrderWrite.java

示例2: handleInternal

import org.apache.hadoop.oncrpc.RpcReply; //导入依赖的package包/类
@Override
public XDR handleInternal(RpcCall rpcCall, final XDR xdr, XDR out,
    InetAddress client, Channel channel) {
  int procedure = rpcCall.getProcedure();
  int xid = rpcCall.getXid();
  RpcAuthSys authSys = null;
  
  // Ignore auth only for NFSPROC3_NULL, especially for Linux clients.
  if (procedure != Nfs3Constant.NFSPROC3_NULL) {
    if (rpcCall.getCredential().getFlavor() != AuthFlavor.AUTH_SYS) {
      LOG.info("Wrong RPC AUTH flavor, "
          + rpcCall.getCredential().getFlavor() + " is not AUTH_SYS.");
      XDR reply = new XDR();
      reply = RpcDeniedReply.voidReply(reply, xid,
          RpcReply.ReplyState.MSG_ACCEPTED,
          RpcDeniedReply.RejectState.AUTH_ERROR);
      return reply;
    }
    authSys = RpcAuthSys.from(rpcCall.getCredential().getBody());
  }
  
  NFS3Response response = null;
  if (procedure == Nfs3Constant.NFSPROC3_NULL) {
    response = nullProcedure();
  } else if (procedure == Nfs3Constant.NFSPROC3_GETATTR) {
    response = getattr(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_SETATTR) {
    response = setattr(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_LOOKUP) {
    response = lookup(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_ACCESS) {
    response = access(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_READLINK) {
    response = readlink(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_READ) {
    response = read(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_WRITE) {
    response = write(xdr, channel, xid, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_CREATE) {
    response = create(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_MKDIR) {      
    response = mkdir(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_SYMLINK) {
    response = symlink(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_MKNOD) {
    response = mknod(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_REMOVE) {
    response = remove(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_RMDIR) {
    response = rmdir(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_RENAME) {
    response = rename(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_LINK) {
    response = link(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_READDIR) {
    response = readdir(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_READDIRPLUS) {
    response = readdirplus(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_FSSTAT) {
    response = fsstat(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_FSINFO) {
    response = fsinfo(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_PATHCONF) {
    response = pathconf(xdr, authSys);
  } else if (procedure == Nfs3Constant.NFSPROC3_COMMIT) {
    response = commit(xdr, authSys);
  } else {
    // Invalid procedure
    RpcAcceptedReply.voidReply(out, xid,
        RpcAcceptedReply.AcceptState.PROC_UNAVAIL);
  }
  if (response != null) {
    out = response.send(out, xid);
  }
  return out;
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:77,代码来源:RpcProgramNfs3.java


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