The facility locator design pattern is use when we want to locate different services using JNDI lookup. In view of high cost of looking up JNDI for a service, Service Locator pattern makes use of caching technique. For the first time a service is necessary, Service Locator looks up in JNDI and caches the service object. Auxiliary lookup or same service via Service Locator is completed in its cache which improves the concert of application to great level. Following are the entity of this kind of design pattern.
We are going to create a ServiceLocator, InitialContext, Cache, and Service as a choice of substance representing our entities.Service1 and Service2 represent existing services.
ServiceLocatorPatternDemo, our presentation class, is performing as a client here and will use Service Locator to display Service Locator Design Pattern.
Create Service interface.
Create concrete services.
Create Initial Context for JNDI lookup
Create Service Locator
Apply the Service Locator to display Service Locator Design Pattern.
Verify the output.
Design Patterns Related Interview Questions
|Java Script Interview Questions||AJAX Interview Questions|
|Graphic Design Interview Questions||Adobe Indesign Interview Questions|
|Java-Multithreading Interview Questions||Database Design Interview Questions|
|Compiler Design Interview Questions||CSS Advanced Interview Questions|
|Java Design Patterns Interview Questions||Hardware design Interview Questions|
|Material Design Lite Interview Questions||Object Oriented Analysis and Design Interview Questions|
|Standard Template Library (STL) Interview Questions|
Design Patterns Tutorial
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.