1

我有一个包含无限循环的函数(MonitorLOg);这是必要的,因为我想监视文件并在有修改时执行操作。但是,myRules在 Drools 中不想启动(“WS 已更新”不会出现)。有什么建议吗?

rule "SmartWssec"
when
PolicyUpdateWssec(changelog == true)
then
System.out.println("WS is updated");
end

///////////////////////////////////////// ////

PolicyUpdateWssec LogModSecurity = new PolicyUpdateWssec();
LogModSecurity.MonitorLog("D:\\Mod");
kSession.insert(LogModSecurity);
kSession.fireAllRules();
LogModSecurity 

////////////////////////

        while(true){
            WatchKey key;
            try {

            // wait for a key to be available

                key = watcher.take();
            } catch (InterruptedException ex) {
                return;
            }

            for (WatchEvent<?> event : key.pollEvents()) {
                // get event type
                WatchEvent.Kind<?> kind = event.kind();

                // get file name
                @SuppressWarnings("unchecked")
                WatchEvent<Path> ev = (WatchEvent<Path>) event;
                Path fileName = ev.context();

                System.out.println(kind.name() + ": " + fileName);

                if (kind == ENTRY_MODIFY ) {
                    changelog=true;
                    setChangelog(changelog);
                    System.out.println("WS-Policy is being Update.......");
4

0 回答 0