mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 10:59:03 +00:00
[refactor] Remove unnecessary declarations in service-locator pattern.
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
package com.iluwatar;
|
||||
|
||||
/**
|
||||
* Service locator pattern, used to lookup jndi services
|
||||
* and cache them for subsequent requests.
|
||||
* @author saifasif
|
||||
* Service locator pattern, used to lookup jndi services
|
||||
* and cache them for subsequent requests.
|
||||
*
|
||||
* @author saifasif
|
||||
*/
|
||||
public class App {
|
||||
public static void main(String[] args) {
|
||||
Service service = ServiceLocator.getService("jndi/serviceA");
|
||||
service.execute();
|
||||
service = ServiceLocator.getService("jndi/serviceB");
|
||||
service.execute();
|
||||
service = ServiceLocator.getService("jndi/serviceA");
|
||||
service.execute();
|
||||
service = ServiceLocator.getService("jndi/serviceA");
|
||||
service.execute();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Service service = ServiceLocator.getService("jndi/serviceA");
|
||||
service.execute();
|
||||
service = ServiceLocator.getService("jndi/serviceB");
|
||||
service.execute();
|
||||
service = ServiceLocator.getService("jndi/serviceA");
|
||||
service.execute();
|
||||
service = ServiceLocator.getService("jndi/serviceA");
|
||||
service.execute();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user