Package org.apache.hadoop.oncrpc

Examples of org.apache.hadoop.oncrpc.RpcInfo


  @Override
  public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
      throws Exception {

    RpcInfo info = (RpcInfo) e.getMessage();
    RpcCall rpcCall = (RpcCall) info.header();
    final int portmapProc = rpcCall.getProcedure();
    int xid = rpcCall.getXid();
    XDR in = new XDR(info.data().toByteBuffer().asReadOnlyBuffer(),
        XDR.State.READING);
    XDR out = new XDR();

    if (portmapProc == PMAPPROC_NULL) {
      out = nullOp(xid, in, out);
    } else if (portmapProc == PMAPPROC_SET) {
      out = set(xid, in, out);
    } else if (portmapProc == PMAPPROC_UNSET) {
      out = unset(xid, in, out);
    } else if (portmapProc == PMAPPROC_DUMP) {
      out = dump(xid, in, out);
    } else if (portmapProc == PMAPPROC_GETPORT) {
      out = getport(xid, in, out);
    } else if (portmapProc == PMAPPROC_GETVERSADDR) {
      out = getport(xid, in, out);
    } else {
      LOG.info("PortmapHandler unknown rpc procedure=" + portmapProc);
      RpcAcceptedReply reply = RpcAcceptedReply.getInstance(xid,
          RpcAcceptedReply.AcceptState.PROC_UNAVAIL, new VerifierNone());
      reply.write(out);
    }

    ChannelBuffer buf = ChannelBuffers.wrappedBuffer(out.asReadOnlyWrap()
        .buffer());
    RpcResponse rsp = new RpcResponse(buf, info.remoteAddress());
    RpcUtil.sendRpcResponse(ctx, rsp);
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.oncrpc.RpcInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.