Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB performance due to remote call confusion

 
Monoj Roy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I was trying to improve the performance of an EJB call . I want to understand how many remote call ejb client makes to get the actual object .
If following are a general steps then is it true that client call two time remote call at the time of look up and at the time of create ? Can any body explain this steps

InformerHome home= (InformerHome)ctx.lookup( "ejb/informer" );
Informer informer = home.create();



// get handle into the EJB naming directory
InitialContext ctx = new InitialContext();

// get hold of the object you want by name
InformerHome home= (InformerHome)ctx.lookup( "ejb/informer" );

// get reference to business interface from home interface
Informer informer = home.create();

// use the business interface
informer.getTheTime() ;

 
Claude Moore
Ranch Hand
Posts: 814
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know in such detailed level what actually happens under the hood when you lookup and get a reference to a remote EJB, but it doesn't sound strange to me that there are actually two distinct calls to remote container.

Anyway if I'm not wrong, you may lookup once EJbs you need and then use their remotely exposed methods; so I don't think you should be worried a lot of how many remote calls in looking up phase are actually made. More likely, you should try to avoid a chatty usage of ejbs (if that's possibile, of course).
 
Monoj Roy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we conclude this way that when we are looking up for the JNDI it calls a remote machine and when we call the home.create of the home object it also gives a remote call ?
 
Claude Moore
Ranch Hand
Posts: 814
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can say only that's likely to happen. To be sure, you can always intercept calls to remote server (using a tpc monitor or tracer listening on your appserver's rmi port) and see what happens at each instruction.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic