public void endOperation ( ) { if ( this . opCounter . decrementAndGet ( ) == 0 ) { // means the engine is idle, so, set the timestamp this . lastIdleTimestamp . set ( this . timerService . getCurrentTime ( ) ) ; if ( this . endOperationListener != null ) { this . endOperationListener . endOperation ( this . getKnowledgeRuntime ( ) ) ; } } }
This method must be called after finishing any work in the engine like inserting a new fact or firing a new rule . It will reset the engine idle time counter .