1. 程式人生 > >併發頁面訪問量統計簡單實現

併發頁面訪問量統計簡單實現

複製程式碼
    /**
     * 根據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; } }
複製程式碼