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());
            }
        }
    }
public void endOperation ( ) { if ( this . opCounter . decrementAndGet ( ) == 0 ) { 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.

This method must be extremely light to avoid contentions when called by
multiple threads/entry-points