Home
Core Java
Java
JDBC
Servlets
JSP
EJB
JMS
Struts
Spring
Hibernate
JSF
RMI
CORBA
J2ME
Performance
Tomcat
Weblogic
Design Patterns
Junit
XML
UML
DB2 & SQL
ANT
Free Gift
Contact Us

XML RSS
What is this?
Add to My Yahoo!
Add to My MSN
Add to Google
 

J2EE Pattern

Service Locator Pattern

Your Ad Here

Creational patterns Structural patterns Behavioral pattern J2EE patterns
Abstract Factory Adapter  Chain of Responsibility
MVC 
Builder Bridge  Command  Business Delegate
Factory method Composite  Interpreter  Composite Entity
Prototype Decorator  Iterator  Data Access Object
Singleton Façade
Mediator  Front Controller

Flyweight  Memento  Intercepting Filter

Proxy  Observer  Service Locator


State  Transfer Object


Strategy 


Template Method



Visitor 

Service Locator



Define Service Locator
Centralizing distributed service object lookups, providing a centralized point of control, acting as a cache that eliminates redundant lookups.

Where to use & benefits
Lookup object in JNDI, RMI, JMS, etc.
Encapsulate any vendor-specific features of lookup process
Simplify the lookup process
Improve the performance

Related patterns include
  • Singlton combined with service locator to make sure only one lookup object exists.

Example Service Locator
Use a container as cache to hold the lookup object. One application only lookups same object once. Doing so will dramatically improve performance. Make sure the container used is thread-safe.

Your Ad Here




footer for Service Locator Pattern page