併發頁面訪問量統計簡單實現
阿新 • • 發佈:2019-01-25
/** * 根據urls生成佇列陣列 * @return */ private static LinkedList<RequestStc>[] initUris() { Digester digester = new Digester(); String path = null; try { path = CounterUtils.class.getClassLoader().getResource("urls.xml").toURI().getPath(); }catch (URISyntaxException e1) { e1.printStackTrace(); } UriRuleSet ruleSet = new UriRuleSet(); ruleSet.addRuleInstances(digester); try { // uri集合 uris = digester.parse(new File(path)); // hashCode基數 BaseHash = uris!=null?uris.size()/3:1; LinkedList<RequestStc>[] listArr = new LinkedList[BaseHash]; for(int i=0; i<listArr.length; i++) listArr[i] = new LinkedList<RequestStc>(); return listArr; } catch (Exception e) { e.printStackTrace();return null; } }