0
任何幫助,請...我想監視Linux系統上的網絡接口,例如對於我已經建立2個規則和類的eth0,其監視inerfacesJBoss Drools 6計時器連續執行
rule "check eth0 down"
timer (cron:0/5 * * * * ?)
when
$device : IapDevice(operstateEth0 == "down")
then
System.out.println("interface eth0 is down");
update($device);
end
rule "check eth0 up"
timer (cron:0/5 * * * * ?)
when
$device : IapDevice(operstateEth0 == "up")
then
System.out.println("interface eth0 is up");
update($device);
end
主要的Java類看起來像
kSession.insert(new IapDevice());
new Thread(new Runnable()
{
public void run()
{
kSession.fireUntilHalt();
}
}).start();
IapDevice
public class IapDevice
{
public String getOperstateEth0()
{
return IfaceUtils.operstateEth0();
}
}
這種設置檢測的狀態的變化接口,但是當它執行時,它會連續輸出System.out.print(),而不是每5秒一次。 我試着在規則中加入[no-loop true],但是它不檢測它是否從down狀態恢復......如何解決這個問題?
問候, Rihards