• Post Reply Bookmark Topic Watch Topic
  • New Topic

RMI and multithreading

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a basic doubt in RMI. How does RMI take care of multiple clients accessing the same method. Does it span a new thread for every client. If so, then do I need to make the method synchronized if I want it to be accessed in a thread-safe manner.
Thanks in anticipation,
Smita.
 
Milind Kulkarni
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Smita,
Excerpts from the RMI Specification -
" A method dispatched by the RMI runtime to a remote object implementation may or may not execute in a separate thread. The RMI runtime makes no guarantees with respect to mapping remote object invocations to threads. Since remote method invocation on the same remote object may execute concurrently, a remote object implementation needs to make sure its implementation is thread-safe."
Regards,
Milind

[This message has been edited by Milind Kulkarni (edited July 17, 2000).]
 
peter brews
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
In the stateless bean i have business methods and utility methods.Please advice if these utility methods need to syncronized if they are being called by multiple business methods in the same bean and the business methods in turn being called by multiple clients at the same time.

Following is piece of code from my ejb :
public interface MySessionEJB extends EJBObject {
public String businessmethod1(String id,String abc)
throws RemoteException, Exception;
public String businessmethod2( String password, Stringdept)
throws RemoteException, Exception;

Thanks,
smita
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!