• Post Reply Bookmark Topic Watch Topic
  • New Topic

Method serialization

 
Christopher Pereira
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi:
How can I send a serialized method invoction via socket.
I don't want to execute it remotly on the server, but just need to inform a server of the methods a client invoked.
But that isn't all:
The server, when getting the information of an invoation, needs to distribute and execute it on other clients (via socket).
In other words, the method invokation from a client A, is distributed by an server S and executed on clients A, B, C, D.
I need to know:
1) How to serialize the method and the arguments (I just know how to serialize the argmuents)
2) How to execute the methods on clients A, B, C, D when recieving the servers order.
Thanks.
 
balaji iyer
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Methods cannot be serialized in Java, only objects can be serialized.
Regarding your second question, the solution is having a controller class on each of the otherclients, B, C and D whose only purpose is to call the desired method. This class would have static information of method names or implement reflection to call the appropriate object and its method.
Once A calls on a method on S, then S has to lookup on this remote object and pass it the method name as a string. This distributed remote object will then call upon the particular objects method on clients, B, C and D.
Hope that helps :-),
for more info,
pls contact me on
balaji@net4nuts.com

------------------
Balaji Iyer,
System Architect,
Net4nuts.com
Ahmedabad
"If you want to make God Laugh, Tell HIM your plans !! "
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!