So basically, I am trying to implement a MapReduce framework in java.
Problem here is, I want slave nodes(machines) know user-defined map and reduce functions. At the beginning, only master node knows what use code is, because by default, users write code on master machine. However, slave nodes and master node are different machines, and machines have network connection.
My idea is, send user's code to slave nodes, that is, send compiled .class file to slave nodes via java RMI. For now, my solution is, treat .class as a normal file, read content of .class into byte[], and send this byte array via java RMI. Once slave node receives byte[], it writes data into local file system, and use ClassLoader to get user-defined code.
So, are there any other solutions to solve this problem?