Skip to content

Commit e269f7e

Browse files
committed
variable name changes
1 parent 81b9a89 commit e269f7e

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎core-java/src/main/java/com/baeldung/designpatterns/service/locator/InitialContext.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
*/
66
public class InitialContext {
77

8-
public Object lookup(String jndiName) {
8+
public Object lookup(String serviceName) {
99

10-
if (jndiName.equalsIgnoreCase("EmailService")) {
10+
if (serviceName.equalsIgnoreCase("EmailService")) {
1111
return new EmailService();
12-
} else if (jndiName.equalsIgnoreCase("SMSService")) {
12+
} else if (serviceName.equalsIgnoreCase("SMSService")) {
1313
return new SMSService();
1414
}
1515
return null;

‎core-java/src/main/java/com/baeldung/designpatterns/service/locator/ServiceLocator.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ public class ServiceLocator {
1111
cache = new Cache();
1212
}
1313

14-
public static MessagingService getService(String jndiName){
14+
public static MessagingService getService(String serviceName){
1515

16-
MessagingService service = cache.getService(jndiName);
16+
MessagingService service = cache.getService(serviceName);
1717

1818
if(service != null){
1919
return service;
2020
}
2121

2222
InitialContext context = new InitialContext();
23-
MessagingService service1 = (MessagingService)context.lookup(jndiName);
23+
MessagingService service1 = (MessagingService)context.lookup(serviceName);
2424
cache.addService(service1);
2525
return service1;
2626
}

0 commit comments

Comments
 (0)