不多说,直接上代码。
代码
package zhouls.bigdata.myWholeHadoop.RPC.rpc1;
import java.io.IOException;
import java.net.InetSocketAddress;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;
public class LoginController {
public static void main(String[] args) throws IOException {
LoginServiceinterface proxy = RPC.getProxy(LoginServiceinterface.class, 1L, new InetSocketAddress("HadoopMaster", 10000), new Configuration());
String result = proxy.login("angelababy","123456");
System.out.println(result);
}
}
package zhouls.bigdata.myWholeHadoop.RPC.rpc1;
public interface LoginServiceinterface {
public static final long versionID=1L;
public String login(String username,String password);
}