Open GoogleCodeExporter opened 9 years ago
下面这段代码,在webapp中redeploy时,会发生死循环,不停地调 用run方法。 final DictionariesCompiler compiler = (DictionariesCompiler)compilerClass.newInstance(); new Function() { public void run() throws Exception { // 编译词典-对词典进行可能的处理,以符合分词器的要求 if (compiler.shouldCompile(p)) { Dictionaries dictionaries = readUnCompiledDictionaries(p); Paoding tempPaoding = createPaodingWithKnives(p); setDictionaries(tempPaoding, dictionaries); compiler.compile(dictionaries, tempPaoding, p); } // 使用编译后的词典 final Dictionaries dictionaries = compiler.readCompliedDictionaries(p); setDictionaries(finalPaoding, dictionaries); // 启动字典动态转载/卸载检测器 // 侦测时间间隔(秒)。默认为60秒。如果设置为0或负数则表示不需要进行检测 String interval = getProperty(p, Constants.DIC_DETECTOR_INTERVAL); dictionaries.startDetecting(Integer.parseInt(interval), new DifferenceListener() { public void on(Difference diff) throws Exception { dictionaries.stopDetecting(); // 此处调用run方法,以当检测到**编译后**的词典变更/删除/增加时, // 重新编译源词典、重新创建并启动dictionaries自检测 run(); } }); } }.run();
Original issue reported on code.google.com by imcap...@gmail.com on 22 Jul 2008 at 8:32
imcap...@gmail.com
Original issue reported on code.google.com by
imcap...@gmail.com
on 22 Jul 2008 at 8:32