• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

子把瓢总

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

踏着前人的脚印学Hadoop——RPC源码

A simple RPC mechanism.A protocol  is a Java interface.  All parameters and return types must be one of:a primitive type(这个注意是9个基本类型,包括void),a String ; or a  Writable or an array of the above types All methods in the protocol should throw only IOException.  No field data of the protocol instance is transmitted.

1、这个RPC有5个内部类。

分别是ClientCache,Invocation,Invoker,Server,VersionMismatch。

更奇葩的是它的构造器是私有的。

2、Invocation

A method invocation, including the method name and its parameters

private String methodName;
private Class[] parameterClasses;
private Object[] parameters;
private Configuration conf;
3、ClientCache

Cache a client using its socket factory as the hash key

private Map<SocketFactory, Client> clients =new HashMap<SocketFactory, Client>();
4、Invoker

private Client.ConnectionId remoteId;
private Client client;
private boolean isClosed = false;
5、VersionMismatch

private String interfaceName;the name of the protocol mismatch 不协调,不搭配
private long clientVersion; the client's version of the protocol
private long serverVersion;the server's version of the protocol

 

Get the client's preferred version

Get the server's agreed to version.

6、Server

An RPC Server.

public static class Server extends org.apache.hadoop.ipc.Server

private Object instance;
private boolean verbose;

posted on 2015-01-01 09:59  子把瓢总  阅读(169)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3