From book 'J2ee Design Pattern' published by Sun, there is a Locator pattern. This mechanism can be implemented by a Ejb, it cache EJBHome objects in their pool. The first time client locate a home, it lookup this home, before return it add it to its pool for later using. But, I suspect that can this improve the performance? If I don't use it, the most I using JNDI to locate EJBHome is only once, oppositely; If I use it, first I have to lookup this locator by JNDI one time, if it is exist, that's fine I return. If not, Locator have to second lookup for the one I need, there are two 'lookup'. So by this way, the system maybe perform 2 'lookup'. Anyone has same feeling?
Regards,
a13519
-
About Locator design pattern (2 messages)
- Posted by: Wallace Zou
- Posted on: August 03 2002 10:21 EDT
Threaded Messages (2)
- About Locator design pattern by Lasse Koskela on August 03 2002 11:44 EDT
- About Locator design pattern by Wallace Zou on August 03 2002 12:40 EDT
-
About Locator design pattern[ Go to top ]
- Posted by: Lasse Koskela
- Posted on: August 03 2002 11:44 EDT
- in response to Wallace Zou
From Sun Java Center J2EE Patterns (link):
<i>"The Service Locator abstracts the API lookup (naming) services, vendor dependencies, lookup complexities, and business object creation and provides a simple interface to clients. This reduces the client’s complexity. In addition, the same client or other clients can reuse the Service Locator."</i>
<p>
So, the amount of lookups is not the only dimension here. Using the Locator pattern, your client code is more independent of the location of the wanted resource/service/whatever. -
About Locator design pattern[ Go to top ]
- Posted by: Wallace Zou
- Posted on: August 03 2002 12:40 EDT
- in response to Lasse Koskela
OOOOOh Yes!
We can implement Locator as a Singleton, not EJB. So we needn't at least one lookup for locating Locator. It's great.
Thanks,
a13519