logger.info("==load cache path:" + cachePath.toString());
ipAreaAnalyser.analyzeFile(dfs.open(cachePath));
logger.info("==complete analyzeFile:" + cachePath.toString());
一直卡在这个 analyzeFile 方法了
analyzeFile 内容如下:
public void analyzeFile(InputStream is) throws Exception {
ipArea = new HashMap<String, String>();
BufferedReader bufferedReader = null;
try {
bufferedReader = new BufferedReader(new InputStreamReader(is));
String lineStr = bufferedReader.readLine();
System.out.println("lineStr:"+lineStr);
while (lineStr != null && lineStr.trim().length() != 0) {
// 解析数据
String[] tmpInfos = lineStr.split(defaultSpace);
System.out.println("tmpInfos length:"+tmpInfos.length);
if (tmpInfos.length == 5) {
System.out.println(tmpInfos[4].substring(1,
tmpInfos[4].length() - 5));
String[] ipSlices = tmpInfos[4].substring(1,
tmpInfos[4].length() - 5).split(ipsSpace);
for (String ips : ipSlices) {
String[] tmpIps = ips.split(ipSpace);
if (tmpIps.length == 2) {
List<String> ipKeys = getIpAreaKeys(tmpIps[0],
tmpIps[1]);
if (ipKeys == null) {
continue;
}
for (String key : ipKeys) {
ipArea.put(key, tmpInfos[1]);
}
ipKeys = null;
}
tmpIps = null;
}
ipSlices = null;
}
tmpInfos = null;
lineStr = bufferedReader.readLine();
}
} catch (Exception e) {
throw e;
} finally {
try {
if (bufferedReader != null) {
bufferedReader.close();
}
} catch (IOException e) {
}
}
if (ipArea.size() == 0) {
throw new Exception("No ip Area data.");
}
}
|