Skip to content

Commit 276b205

Browse files
authored
murderers, and whoremongers, and sorcerers
But the fearful, and unbelieving, and the abominable, and murderers, and whoremongers, and sorcerers, and idolaters, and all liars, shall have their part in the lake which burneth with fire and brimstone: which is the second death. (Revelation 21:8)
1 parent d3f5dfd commit 276b205

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
2+
//But the fearful, and unbelieving, and the abominable, and murderers, and whoremongers, and sorcerers,
3+
//and idolaters, and all liars, shall have their part in the lake which burneth with fire and brimstone: which is the second death. (Revelation 21:8)
4+
5+
package com.javarush.task.task32.task3212.service.impl;
6+
7+
import com.javarush.task.task32.task3212.service.Service;
8+
9+
public class JMSServiceImpl implements Service {
10+
11+
@Override
12+
public void execute() {
13+
System.out.println("Executing JMSService");
14+
}
15+
16+
@Override
17+
public String getName() {
18+
return "JMSService";
19+
}
20+
21+
}
22+
23+
/*
24+
Service Locator
25+
26+
Прочитать о паттерне Service locator.
27+
28+
29+
30+
Реализуй логику метода getService(String jndiName) в ServiceLocator.
31+
32+
В нем будет реализована работа с контекстом и кэшем.
33+
34+
35+
36+
1) Верни из кэша нужный сервис.
37+
38+
2) Если в кэше нет нужного сервиса то:
39+
40+
2.1) Создай контекст.
41+
42+
2.2) Возьми у контекста нужный сервис.
43+
44+
2.3) Добавь сервис в кеш и верни его.
45+
46+
47+
48+
49+
50+
Требования:
51+
52+
1. Класс ServiceLocator должен содержать метод Service getService(String jndiName).
53+
54+
2. Если нужный сервис находится в кэше, метод getService(String jndiName) должен возвращать сервис из кэша.
55+
56+
3. Если нужный сервис НЕ находится в кэше, метод getService(String jndiName) должен создавать контекст.
57+
58+
4. Если нужный сервис НЕ находится в кэше, метод getService(String jndiName) должен искать нужный сервис в контексте.
59+
60+
5. Если нужный сервис НЕ находится в кэше, метод getService(String jndiName) должен добавлять в кэш сервис, найденный в контексте и возвращать его.
61+
*/

0 commit comments

Comments
 (0)