How to realize RPC experiment
This article will give you a detailed explanation on how to implement the RPC experiment. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Public class MyClient {public static void main (String [] args) throws Exception {final InetSocketAddress inetSocketAddress = new InetSocketAddress ("localhost", MyServer.PORT); MyRPCProtocol rpc = (MyRPCProtocol) RPC.getProxy (MyRPCProtocol.class, MyRPCProtocol.versionID, inetSocketAddress, new Configuration ()); String str = rpc.hello ("Xi Jinping"); System.out.println (str); RPC.stopProxy (rpc);}}
Dependency packages: hadoop-core-1.2.1, commons-configuration-1.6, commons-lang-2.4, commons-logging-1.1.1
This is the end of the article on "how to achieve RPC experiment". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.