final InternalWorkingMemory workingMemory,
final WindowMemory memory,
final SlidingTimeWindow stw,
final Object context,
final int nodeId ) {
TimerService clock = workingMemory.getTimerService();
if ( fact != null ) {
long nextTimestamp = ((EventFactHandle) fact).getStartTimestamp() + stw.getSize();
if ( nextTimestamp < clock.getCurrentTime() ) {
// JBRULES-2258 Past and out-of-order events should not be insert,
// but the engine silently accepts them anyway, resulting in possibly undesirable behaviors
workingMemory.queueWorkingMemoryAction( new BehaviorExpireWMAction( nodeId,
stw,
memory,
context ) );
} else {
JobContext jobctx = new BehaviorJobContext( nodeId,
workingMemory,
stw,
memory,
context );
JobHandle handle = clock.scheduleJob( job,
jobctx,
new PointInTimeTrigger( nextTimestamp, null, null ) );
jobctx.setJobHandle( handle );
}
}