...
|
...
|
@@ -30,30 +30,56 @@ public class ForbiddenPageIdsLogicService { |
|
|
private static final String key = "SEARCH_FORBIDDEN_SKNLIST_%s";
|
|
|
|
|
|
private Map<String, List<String>> skn_forbiddenPageIds_map = null;
|
|
|
|
|
|
public List<String> getPageIdForbiddenSkns(String pageId) {
|
|
|
if (skn_forbiddenPageIds_map == null || skn_forbiddenPageIds_map.isEmpty()) {
|
|
|
return new ArrayList<String>();
|
|
|
}
|
|
|
return skn_forbiddenPageIds_map.get(pageId);
|
|
|
}
|
|
|
|
|
|
public synchronized Map<String, List<String>> reloadForbiddenPageIds() {
|
|
|
INDEX_REBUILD_LOG.info("do reloadForbiddenPageIds .........");
|
|
|
List<String> allPageIds = SearchPageIdDefine.getAllPgeIds();
|
|
|
Map<String, List<String>> temp = new HashMap<String, List<String>>();
|
|
|
for (String pageId : allPageIds) {
|
|
|
Set<String> forbiddenSknSet = this.getPageForbiddenSknSet(pageId);
|
|
|
for (String forbiddenSkn : forbiddenSknSet) {
|
|
|
List<String> pageIds = temp.get(forbiddenSkn);
|
|
|
if (pageIds == null) {
|
|
|
pageIds = new ArrayList<String>();
|
|
|
temp.put(forbiddenSkn, pageIds);
|
|
|
private volatile boolean isReloading = false;
|
|
|
|
|
|
public synchronized Map<String, Integer> reloadForbiddenPageIds() {
|
|
|
Map<String, Integer> pageCountMap = new HashMap<String, Integer>();
|
|
|
try {
|
|
|
INDEX_REBUILD_LOG.info("do reloadForbiddenPageIds .........");
|
|
|
isReloading = true;
|
|
|
List<String> allPageIds = SearchPageIdDefine.getAllPgeIds();
|
|
|
Map<String, List<String>> temp = new HashMap<String, List<String>>();
|
|
|
for (String pageId : allPageIds) {
|
|
|
Set<String> forbiddenSknSet = this.getPageForbiddenSknSet(pageId);
|
|
|
for (String forbiddenSkn : forbiddenSknSet) {
|
|
|
List<String> pageIds = temp.get(forbiddenSkn);
|
|
|
if (pageIds == null) {
|
|
|
pageIds = new ArrayList<String>();
|
|
|
temp.put(forbiddenSkn, pageIds);
|
|
|
}
|
|
|
pageIds.add(pageId);
|
|
|
}
|
|
|
pageIds.add(pageId);
|
|
|
pageCountMap.put(pageId, forbiddenSknSet.size());
|
|
|
}
|
|
|
skn_forbiddenPageIds_map = temp;
|
|
|
} catch (Exception e) {
|
|
|
INDEX_REBUILD_LOG.error(e.getMessage(), e);
|
|
|
} finally {
|
|
|
isReloading = false;
|
|
|
}
|
|
|
skn_forbiddenPageIds_map = temp;
|
|
|
return skn_forbiddenPageIds_map;
|
|
|
return pageCountMap;
|
|
|
}
|
|
|
|
|
|
private synchronized void checkAndInit() {
|
|
|
if (skn_forbiddenPageIds_map == null) {
|
|
|
if (skn_forbiddenPageIds_map == null || skn_forbiddenPageIds_map.isEmpty()) {
|
|
|
reloadForbiddenPageIds();
|
|
|
}
|
|
|
while (isReloading) {
|
|
|
try {
|
|
|
INDEX_REBUILD_LOG.info("is reloading ForbiddenPageIds ,wait 1000ms .........");
|
|
|
Thread.sleep(1000);
|
|
|
} catch (Exception e) {
|
|
|
INDEX_REBUILD_LOG.error(e.getMessage(), e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private Set<String> getPageForbiddenSknSet(String pageId) {
|
...
|
...
|
|