Search in sources :

Example 6 with StateEventPool

use of org.wso2.siddhi.core.event.state.StateEventPool in project siddhi by wso2.

the class WrappedSnapshotOutputRateLimiter method init.

public void init(int outPutAttributeSize, List<AttributeProcessor> attributeProcessorList, MetaComplexEvent metaComplexEvent) {
    for (AttributeProcessor attributeProcessor : attributeProcessorList) {
        if (attributeProcessor.getExpressionExecutor() instanceof AbstractAggregationAttributeExecutor) {
            aggregateAttributePositionList.add(attributeProcessor.getOutputPosition());
        }
    }
    if (windowed) {
        if (groupBy) {
            if (outPutAttributeSize == aggregateAttributePositionList.size()) {
                // All Aggregation
                outputRateLimiter = new AllAggregationGroupByWindowedPerSnapshotOutputRateLimiter(id, value, scheduledExecutorService, this, siddhiAppContext, queryName);
            } else if (aggregateAttributePositionList.size() > 0) {
                // Some Aggregation
                outputRateLimiter = new AggregationGroupByWindowedPerSnapshotOutputRateLimiter(id, value, scheduledExecutorService, aggregateAttributePositionList, this, siddhiAppContext, queryName);
            } else {
                // No aggregation
                // GroupBy is same as Non GroupBy
                outputRateLimiter = new WindowedPerSnapshotOutputRateLimiter(id, value, scheduledExecutorService, this, siddhiAppContext, queryName);
            }
        } else {
            if (outPutAttributeSize == aggregateAttributePositionList.size()) {
                // All Aggregation
                outputRateLimiter = new AllAggregationPerSnapshotOutputRateLimiter(id, value, scheduledExecutorService, this, siddhiAppContext, queryName);
            } else if (aggregateAttributePositionList.size() > 0) {
                // Some Aggregation
                outputRateLimiter = new AggregationWindowedPerSnapshotOutputRateLimiter(id, value, scheduledExecutorService, aggregateAttributePositionList, this, siddhiAppContext, queryName);
            } else {
                // No aggregation
                outputRateLimiter = new WindowedPerSnapshotOutputRateLimiter(id, value, scheduledExecutorService, this, siddhiAppContext, queryName);
            }
        }
    } else {
        if (groupBy) {
            outputRateLimiter = new GroupByPerSnapshotOutputRateLimiter(id, value, scheduledExecutorService, this, siddhiAppContext, queryName);
        } else {
            outputRateLimiter = new PerSnapshotOutputRateLimiter(id, value, scheduledExecutorService, this, siddhiAppContext, queryName);
        }
    }
    if (metaComplexEvent instanceof MetaStateEvent) {
        StateEventPool stateEventPool = new StateEventPool((MetaStateEvent) metaComplexEvent, 5);
        outputRateLimiter.setStateEventCloner(new StateEventCloner((MetaStateEvent) metaComplexEvent, stateEventPool));
    } else {
        StreamEventPool streamEventPool = new StreamEventPool((MetaStreamEvent) metaComplexEvent, 5);
        outputRateLimiter.setStreamEventCloner(new StreamEventCloner((MetaStreamEvent) metaComplexEvent, streamEventPool));
    }
}
Also used : AbstractAggregationAttributeExecutor(org.wso2.siddhi.core.query.selector.attribute.processor.executor.AbstractAggregationAttributeExecutor) StateEventPool(org.wso2.siddhi.core.event.state.StateEventPool) MetaStateEvent(org.wso2.siddhi.core.event.state.MetaStateEvent) StreamEventPool(org.wso2.siddhi.core.event.stream.StreamEventPool) StreamEventCloner(org.wso2.siddhi.core.event.stream.StreamEventCloner) AttributeProcessor(org.wso2.siddhi.core.query.selector.attribute.processor.AttributeProcessor) StateEventCloner(org.wso2.siddhi.core.event.state.StateEventCloner) MetaStreamEvent(org.wso2.siddhi.core.event.stream.MetaStreamEvent)

Aggregations

StateEventPool (org.wso2.siddhi.core.event.state.StateEventPool)4 MetaStreamEvent (org.wso2.siddhi.core.event.stream.MetaStreamEvent)4 MetaStateEvent (org.wso2.siddhi.core.event.state.MetaStateEvent)3 StreamEventPool (org.wso2.siddhi.core.event.stream.StreamEventPool)3 StateEventCloner (org.wso2.siddhi.core.event.state.StateEventCloner)2 StreamEventCloner (org.wso2.siddhi.core.event.stream.StreamEventCloner)2 ComplexEvent (org.wso2.siddhi.core.event.ComplexEvent)1 ComplexEventChunk (org.wso2.siddhi.core.event.ComplexEventChunk)1 StateEvent (org.wso2.siddhi.core.event.state.StateEvent)1 StreamEvent (org.wso2.siddhi.core.event.stream.StreamEvent)1 StreamEventConverter (org.wso2.siddhi.core.event.stream.converter.StreamEventConverter)1 ZeroStreamEventConverter (org.wso2.siddhi.core.event.stream.converter.ZeroStreamEventConverter)1 ComplexEventPopulater (org.wso2.siddhi.core.event.stream.populater.ComplexEventPopulater)1 SiddhiAppCreationException (org.wso2.siddhi.core.exception.SiddhiAppCreationException)1 ProcessStreamReceiver (org.wso2.siddhi.core.query.input.ProcessStreamReceiver)1 JoinProcessor (org.wso2.siddhi.core.query.input.stream.join.JoinProcessor)1 SingleStreamRuntime (org.wso2.siddhi.core.query.input.stream.single.SingleStreamRuntime)1 StreamPreStateProcessor (org.wso2.siddhi.core.query.input.stream.state.StreamPreStateProcessor)1 DeleteTableCallback (org.wso2.siddhi.core.query.output.callback.DeleteTableCallback)1 InsertIntoStreamCallback (org.wso2.siddhi.core.query.output.callback.InsertIntoStreamCallback)1