• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt: SLSBs, Service Locators and Static Access

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic