@Override
    protected StateFactory init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader,
                                SiddhiQueryContext siddhiQueryContext) {
        this.siddhiQueryContext = siddhiQueryContext;
        if (attributeExpressionExecutors.length == 2) {
            length = (Integer) ((ConstantExpressionExecutor) attributeExpressionExecutors[1]).getValue();
            if (attributeExpressionExecutors[0] instanceof ConstantExpressionExecutor) {
                if (attributeExpressionExecutors[0].getReturnType() == Attribute.Type.INT) {
                    timeInMilliSeconds = (Integer) ((ConstantExpressionExecutor) attributeExpressionExecutors[0])
                            .getValue();

                } else if (attributeExpressionExecutors[0].getReturnType() == Attribute.Type.LONG) {
                    timeInMilliSeconds = (Long) ((ConstantExpressionExecutor) attributeExpressionExecutors[0])
                            .getValue();
                } else {
                    throw new SiddhiAppValidationException("TimeLength window's first parameter attribute should " +
                            "be either int or long, but found " + attributeExpressionExecutors[0].getReturnType());
                }
            } else {
                throw new SiddhiAppValidationException("TimeLength window should have constant parameter " +
                        "attributes but found a dynamic attribute " + attributeExpressionExecutors[0].getClass()
                        .getCanonicalName());
            }
        } else {
            throw new SiddhiAppValidationException("TimeLength window should only have two parameters (<int> " +
                    "windowTime,<int> windowLength), but found " + attributeExpressionExecutors.length + " input " +
                    "attributes");
        }
        return () -> new WindowState(streamEventClonerHolder);

    }
Implementation of {@link WindowProcessor} which represent a Window operating based on pre-defined length.
modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/TimeLengthWindowProcessor.java