@Override
    protected void process(ComplexEventChunk<StreamEvent> streamEventChunk, Processor nextProcessor,
                           StreamEventCloner streamEventCloner, WindowState state) {
        List<ComplexEventChunk<StreamEvent>> streamEventChunks = new ArrayList<>();
        synchronized (state) {
            ComplexEventChunk<StreamEvent> outputStreamEventChunk = new ComplexEventChunk<>();
            long currentTime = siddhiQueryContext.getSiddhiAppContext().getTimestampGenerator().currentTime();
            while (streamEventChunk.hasNext()) {
                StreamEvent streamEvent = streamEventChunk.next();
                streamEventChunk.remove();
                if (length == 0) {
                    processLengthZeroBatch(streamEvent, outputStreamEventChunk, currentTime, streamEventCloner);
                } else {
                    if (state.resetEvent == null) {
                        state.resetEvent = streamEventCloner.copyStreamEvent(streamEvent);
                        state.resetEvent.setType(ComplexEvent.Type.RESET);
                    }
                    if (isStreamCurrentEvents) {
                        processStreamCurrentEvents(streamEvent, outputStreamEventChunk, currentTime, state,
                                streamEventCloner);
                    } else {
                        processFullBatchEvents(streamEvent, outputStreamEventChunk, currentTime, state,
                                streamEventCloner);
                    }
                }
                if (outputStreamEventChunk.getFirst() != null) {
                    streamEventChunks.add(outputStreamEventChunk);
                    outputStreamEventChunk = new ComplexEventChunk<>();
                }
            }
        }
        for (ComplexEventChunk<StreamEvent> outputStreamEventChunk : streamEventChunks) {
            nextProcessor.process(outputStreamEventChunk);
        }
    }
Implementation of {@link WindowProcessor} which represent a Batch Window operating based on pre-defined length.
modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LengthBatchWindowProcessor.java