Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

RMI basic questions

 
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
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • 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.
 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic