To understand the message communication mechanism of Hadoop, we need to understand the dynamic agent of Java.
This is a decorative mode, with dynamic proxy implementation, with static factory generated by the specific implementation of the proxy class. Here is the proxy for set set.
When defining a generic method, you must precede a <t> to declare that this is a generic method, hold a generic t, and then use generic t as the function return value.
The Invocationhandler interface is used to intercept the method calls of the proxy object.
Next is the specific use of the proxy object
After using the proxy object, the function of set is upgraded (wrapper mode), and the function of logging is accomplished by intercepting the proxy object.
Write here today, at night if you have time to write, RPC is the core of Hadoop communication, the bottom layer is through the dynamic proxy to achieve, but the specific implementation of the object of the agent may be in the remote virtual machine, class capacity, slowly analyze it
HDFs source code Analysis of RPC