Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

objects passed by reference  RSS feed

 
Manas Ahlaad
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the differnece in the code when objects r
passed by reference in RMI?
 
mukund kulkarni
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At client side there is no difference.
In RMI you can pass the object by two ways
1) BY value.
2) By Reference
Object passed by value are serialized over the network and a new copy is created at the client side.
whe the object is passed by reference original object resideds at client side. only reference is passed to the client.
(in RMI this object should implement java.rmi.Remote interface)
Although at client side there is no diff. you can call any method of remote object s it resides in your machine . RMI takes care of everything.
hope itgives your answer

------------------
 
chanoch wiggers
Author
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i guess there might be performance implications depending on the kind of use you make of the objects?
serializing an object is a significant task, but then so is a callback across the wire - would this not make a difference
chanoch
 
mukund kulkarni
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If we consider perfomance then there we have to have a find out a trade off.
If object is very bulky then it is always better to send it by reference.
however by sending object by reference each time you call any method on it ,it actually goes thro' the network. number of network call increases.
Which one is to use is depends on the content of the object.
 
Manas Ahlaad
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

thanks mukund ,for your valuable answer!
it answerd my question
regards
manas
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!