close #1
This commit is contained in:
@@ -33,7 +33,11 @@ public class IndexServlet extends HttpServlet {
|
||||
model.put("rutext", "Поиск кино по пиратским кинотеатрам");
|
||||
|
||||
if (request.getParameter("search") != null && !request.getParameter("search").trim().isEmpty()) {
|
||||
search(request.getParameter("search"), model);
|
||||
boolean strong = false;
|
||||
if (request.getParameter("strong") != null && request.getParameter("strong").equals("1")) {
|
||||
strong = true;
|
||||
}
|
||||
search(request.getParameter("search"), model, strong);
|
||||
}
|
||||
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
@@ -45,14 +49,14 @@ public class IndexServlet extends HttpServlet {
|
||||
}
|
||||
}
|
||||
|
||||
private void search(String search, Map<String, Object> model) {
|
||||
private void search(String search, Map<String, Object> model, boolean strong) {
|
||||
List<Kino> list = Collections.synchronizedList(new LinkedList<>());
|
||||
Set<KinoWarez> kinoWarezSet = Tools.getKinoWarezSet();
|
||||
|
||||
ThreadGroup threadGroup = new ThreadGroup("");
|
||||
for (KinoWarez kinoWarez : kinoWarezSet) { //TODO на будущее надо ограничить количество одновременных потоков
|
||||
new Thread(threadGroup, () -> {
|
||||
kinoWarez.search(search, list);
|
||||
kinoWarez.search(search, list, strong);
|
||||
}).start();
|
||||
}
|
||||
|
||||
@@ -65,6 +69,7 @@ public class IndexServlet extends HttpServlet {
|
||||
|
||||
model.put("searchtext", search);
|
||||
model.put("resultsearch", list);
|
||||
model.put("strong", strong);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user