• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt: SLSBs, Service Locators and Static Access

 
Alessandro Martins
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, guys, if someone could land me a hand...:

I have a Web Application that uses a Proxy/Service Locator to find out this SLSB, hiding all the looking-up paraphernalia from the client Servlet. The data is accessed by this servlet via a static method. Something like this:

Servlet:

doPost(...) {
...
String data = XYZProxy.getData();
...
}

XYZProxy (Service Locator):

public static String getData() {

XYZ_SB remote;
XYZ_SBHome home;

... lookup stuff ...

return XYZ_SB.getData();

}

My question is: does the static access to the Service Locating method affect the overall performance of my Enterprise Application? Having in mind that the multiple Servlet threads will be accessing concurrently this method, even in a situation that we don't have any persistent state, could this make the JVM unnecessarily busy by hanndling the access to this method? Would it be better if I let this method an instance one and instantiate the XYZProxy class, so each thread would have control over its own instance? Or am I saying any newbie bull%#@?

Thanks a lot in advance,
Alessandro Martins
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35728
412
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alessandro,
From a performance point of view, both solutions are equivalent.

I would favor using instance methods because it makes the code more extensible in the future. You could still use static data though.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!