• Post Reply Bookmark Topic Watch Topic
  • New Topic

RMI basic questions

 
Prashant Neginahal
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have some basic following RMI questions. Please somebody do answer.

1) Can an array containing non-serializabale objects be parameter to remote method?

2) What is wrong with following remote method signature?I mean is Serializable as parameter correct?

public void doit(Serilizable ser)

3) What happens when we use marker interfaces Remote and Serializable? ?How these bring difference when we use and dont use?

Thanks and Regards,
Prashant
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.) No. You would get an exception when you tried to invoke the method because the parameter could not be serialized.
2.) I'm sure you could do that, but it doesn't make sense because you would always have to cast the "Serializable" parameter to an interface you could actually use inside the remote method. Why not just make an interface with methods that you need that extends Serializable?
3.) Serializable means that a copy of the object is sent as a parameter/return value/etc. Remote means that a stub is sent. This behaves more like an actual reference to the object.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!