|
|
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.
|
|
|