Example usage for org.apache.hadoop.ipc RPC getProtocolProxy

List of usage examples for org.apache.hadoop.ipc RPC getProtocolProxy

Introduction

In this page you can find the example usage for org.apache.hadoop.ipc RPC getProtocolProxy.

Prototype

public static <T> ProtocolProxy<T> getProtocolProxy(Class<T> protocol, long clientVersion,
        InetSocketAddress addr, UserGroupInformation ticket, Configuration conf, SocketFactory factory)
        throws IOException 

Source Link

Document

Get a protocol proxy that contains a proxy connection to a remote server and a set of methods that are supported by the server

Usage

From source file:backup.datanode.ipc.DataNodeBackupRPC.java

License:Apache License

public static DataNodeBackupRPC getDataNodeBackupRPC(InetSocketAddress dataNodeIPCAddress, Configuration conf,
        UserGroupInformation ugi) throws IOException, InterruptedException {
    int port = conf.getInt(DFS_BACKUP_DATANODE_RPC_PORT_KEY, DFS_BACKUP_DATANODE_RPC_PORT_DEFAULT);
    if (port == 0) {
        port = dataNodeIPCAddress.getPort() + 1;
    }/* ww  w  .  ja  va  2s  . c om*/
    InetSocketAddress dataNodeAddress = new InetSocketAddress(dataNodeIPCAddress.getAddress(), port);
    return RPC.getProtocolProxy(DataNodeBackupRPC.class, RPC.getProtocolVersion(DataNodeBackupRPC.class),
            dataNodeAddress, ugi, conf, NetUtils.getDefaultSocketFactory(conf)).getProxy();
}

From source file:backup.namenode.ipc.NameNodeBackupRPC.java

License:Apache License

public static NameNodeBackupRPC getDataNodeBackupRPC(InetSocketAddress nameNodeIPCAddres, Configuration conf,
        UserGroupInformation ugi) throws IOException, InterruptedException {
    int port = conf.getInt(DFS_BACKUP_NAMENODE_RPC_PORT_KEY, DFS_BACKUP_NAMENODE_RPC_PORT_DEFAULT);
    if (port == 0) {
        port = nameNodeIPCAddres.getPort() + 1;
    }/*from   w  w  w . ja v  a2  s . co  m*/
    InetSocketAddress nameNodeAddress = new InetSocketAddress(nameNodeIPCAddres.getAddress(), port);
    return RPC.getProtocolProxy(NameNodeBackupRPC.class, RPC.getProtocolVersion(NameNodeBackupRPC.class),
            nameNodeAddress, ugi, conf, NetUtils.getDefaultSocketFactory(conf)).getProxy();
}