public void add(ComplexEventChunk complexEventChunk) {
        try {
            this.lockWrapper.lock();
            complexEventChunk.reset();

            // Convert all events to StreamEvent because StateEvents can be passed if directly received from a join
            ComplexEvent complexEvents = complexEventChunk.getFirst();
            StreamEvent firstEvent = streamEventFactory.newInstance();
            eventConverter.convertComplexEvent(complexEvents, firstEvent);
            StreamEvent currentEvent = firstEvent;
            complexEvents = complexEvents.getNext();
            int numberOfEvents = 0;
            while (complexEvents != null) {
                numberOfEvents++;
                StreamEvent nextEvent = streamEventFactory.newInstance();
                eventConverter.convertComplexEvent(complexEvents, nextEvent);
                currentEvent.setNext(nextEvent);
                currentEvent = nextEvent;
                complexEvents = complexEvents.getNext();
            }

            try {
                if (throughputTrackerInsert != null &&
                        Level.BASIC.compareTo(siddhiAppContext.getRootMetricsLevel()) <= 0) {
                    throughputTrackerInsert.eventsIn(numberOfEvents);
                }
                if (latencyTrackerInsert != null &&
                        Level.BASIC.compareTo(siddhiAppContext.getRootMetricsLevel()) <= 0) {
                    latencyTrackerInsert.markIn();
                }
                // Send to the window windowProcessor
                windowProcessor.process(new ComplexEventChunk<>(firstEvent, currentEvent));
            } finally {
                if (latencyTrackerInsert != null &&
                        Level.BASIC.compareTo(siddhiAppContext.getRootMetricsLevel()) <= 0) {
                    latencyTrackerInsert.markOut();
                }
            }
        } finally {
            this.lockWrapper.unlock();
        }
    }
Add the given ComplexEventChunk to the Window.

@param complexEventChunk the event chunk to be added
modules/siddhi-core/src/main/java/io/siddhi/core/window/Window.java