public void write(MarshallerWriteContext outputCtx) throws IOException { outputCtx.writeShort( WorkingMemoryAction.WorkingMemoryBehahviourRetract ); // write out SlidingTimeWindowContext SlidingTimeWindowContext slCtx = ( SlidingTimeWindowContext ) context; EventFactHandle handle = slCtx.getQueue().peek(); outputCtx.writeInt( handle.getId() ); }
public void write(JobContext jobCtx, MarshallerWriteContext outputCtx) throws IOException { outputCtx.writeShort( PersisterEnums.BEHAVIOR_TIMER ); // BehaviorJob, no state BehaviorJobContext bjobCtx = ( BehaviorJobContext ) jobCtx; // write out SlidingTimeWindowContext SlidingTimeWindowContext slCtx = ( SlidingTimeWindowContext ) bjobCtx.behaviorContext; EventFactHandle handle = slCtx.getQueue().peek(); outputCtx.writeInt( handle.getId() ); // BetaNode node = (BetaNode) handle.getRightTupleSink(); // outputCtx.writeInt( node.getId() ); // // Behavior[] behaviors = node.getBehaviors(); // int i = 0; // for ( ; i < behaviors.length; i++ ) { // if ( behaviors[i] == bjobCtx.behavior ) { // break; // } // } // outputCtx.writeInt( i ); }
public Timer serialize(JobContext jobCtx, MarshallerWriteContext outputCtx) { // BehaviorJob, no state BehaviorJobContext bjobCtx = ( BehaviorJobContext ) jobCtx; // write out SlidingTimeWindowContext SlidingTimeWindowContext slCtx = ( SlidingTimeWindowContext ) bjobCtx.behaviorContext; EventFactHandle handle = slCtx.getQueue().peek(); return ProtobufMessages.Timers.Timer.newBuilder() .setType( ProtobufMessages.Timers.TimerType.BEHAVIOR ) .setBehavior( ProtobufMessages.Timers.BehaviorTimer.newBuilder() .setHandleId( handle.getId() ) .build() ) .build(); } }
public EventFactHandle clone() { EventFactHandle clone = new EventFactHandle( getId(), getObject(), getRecency(), startTimestamp, duration, getEntryPoint(), isTraitOrTraitable()); clone.activationsCount = activationsCount; clone.expired = expired; clone.setEntryPoint( getEntryPoint() ); clone.setEqualityKey( getEqualityKey() ); clone.setFirstLeftTuple(getLastLeftTuple()); clone.setLastLeftTuple(getLastLeftTuple()); clone.setFirstRightTuple(getFirstRightTuple()); clone.setLastRightTuple(getLastRightTuple()); clone.setObjectHashCode(getObjectHashCode()); clone.firstWindowTuple = firstWindowTuple; clone.lastWindowTuple = lastWindowTuple; return clone; }