Package com.espertech.esper.pattern.pool

Examples of com.espertech.esper.pattern.pool.PatternSubexpressionPoolStmtSvc


                statementAgentInstanceRegistry = contextDescriptor.getAiResourceRegistryFactory().make();
            }
        }

        boolean countSubexpressions = engineServices.getConfigSnapshot().getEngineDefaults().getPatterns().getMaxSubexpressions() != null;
        PatternSubexpressionPoolStmtSvc patternSubexpressionPoolStmtSvc = null;
        if (countSubexpressions) {
            PatternSubexpressionPoolStmtHandler stmtCounter = new PatternSubexpressionPoolStmtHandler();
            patternSubexpressionPoolStmtSvc = new PatternSubexpressionPoolStmtSvc(engineServices.getPatternSubexpressionPoolSvc(), stmtCounter);
            engineServices.getPatternSubexpressionPoolSvc().addPatternContext(statementName, stmtCounter);
        }
       
        // Create statement context
        return new StatementContext(engineServices.getEngineURI(),
View Full Code Here


                statementAgentInstanceRegistry = contextDescriptor.getAiResourceRegistryFactory().make();
            }
        }

        boolean countSubexpressions = engineServices.getConfigSnapshot().getEngineDefaults().getPatterns().getMaxSubexpressions() != null;
        PatternSubexpressionPoolStmtSvc patternSubexpressionPoolStmtSvc = null;
        if (countSubexpressions) {
            PatternSubexpressionPoolStmtHandler stmtCounter = new PatternSubexpressionPoolStmtHandler();
            patternSubexpressionPoolStmtSvc = new PatternSubexpressionPoolStmtSvc(engineServices.getPatternSubexpressionPoolSvc(), stmtCounter);
            engineServices.getPatternSubexpressionPoolSvc().addPatternContext(statementName, stmtCounter);
        }

        AgentInstanceScriptContext defaultAgentInstanceScriptContext = null;
        if (statementSpecRaw.getScriptExpressions() != null && !statementSpecRaw.getScriptExpressions().isEmpty()) {
View Full Code Here

        if (isQuitted)
        {
            nodes.remove(fromNode);
            if (index != null && index > 0) {
                countActivePerChild[index - 1]--;
                PatternSubexpressionPoolStmtSvc poolSvc = evalFollowedByNode.getContext().getStatementContext().getPatternSubexpressionPoolSvc();
                poolSvc.getEngineSvc().decreaseCount(evalFollowedByNode);
                poolSvc.getStmtHandler().decreaseCount();
            }
        }

        // the node may already have quit as a result of an outer state quitting this state,
        // however the callback may still be received; It is fine to ignore this callback.
        if (index == null)
        {
            return;
        }

        // If the match came from the very last filter, need to escalate
        int numChildNodes = evalFollowedByNode.getChildNodes().length;
        if (index == (numChildNodes - 1))
        {
            boolean isFollowedByQuitted = false;
            if (nodes.isEmpty())
            {
                isFollowedByQuitted = true;
            }

            this.getParentEvaluator().evaluateTrue(matchEvent, this, isFollowedByQuitted);
        }
        // Else start a new sub-expression for the next-in-line filter
        else
        {
            int max = evalFollowedByNode.getFactoryNode().getMax(index);
            if ((max != -1) && (max >=0)) {
                if (countActivePerChild[index] >= max) {
                    evalFollowedByNode.getContext().getAgentInstanceContext().getStatementContext().getExceptionHandlingService().handleCondition(new ConditionPatternSubexpressionMax(max), evalFollowedByNode.getContext().getAgentInstanceContext().getStatementContext().getEpStatementHandle());
                    return;
                }
            }
            PatternSubexpressionPoolStmtSvc poolSvc = evalFollowedByNode.getContext().getStatementContext().getPatternSubexpressionPoolSvc();
            boolean allow = poolSvc.getEngineSvc().tryIncreaseCount(evalFollowedByNode);
            if (!allow) {
                return;
            }
            poolSvc.getStmtHandler().increaseCount();
            countActivePerChild[index]++;

            EvalNode child = evalFollowedByNode.getChildNodes()[index + 1];
            EvalStateNode childState = child.newState(this, matchEvent, null);
            nodes.put(childState, index + 1);
View Full Code Here

    {
        fromNode.quit();
        Integer index = nodes.remove(fromNode);
        if (index != null && index > 0) {
            countActivePerChild[index - 1]--;
            PatternSubexpressionPoolStmtSvc poolSvc = evalFollowedByNode.getContext().getStatementContext().getPatternSubexpressionPoolSvc();
            poolSvc.getEngineSvc().decreaseCount(evalFollowedByNode);
            poolSvc.getStmtHandler().decreaseCount();
        }

        if (nodes.isEmpty())
        {
            this.getParentEvaluator().evaluateFalse(this);
View Full Code Here

    {
        for (Map.Entry<EvalStateNode, Integer> entry : nodes.entrySet())
        {
            entry.getKey().quit();
            if (entry.getValue() > 0) {
                PatternSubexpressionPoolStmtSvc poolSvc = evalFollowedByNode.getContext().getStatementContext().getPatternSubexpressionPoolSvc();
                poolSvc.getEngineSvc().decreaseCount(evalFollowedByNode);
                poolSvc.getStmtHandler().decreaseCount();
            }
        }
    }
View Full Code Here

        if (isQuitted)
        {
            nodes.remove(fromNode);
            if (index != null && index > 0) {
                PatternSubexpressionPoolStmtSvc poolSvc = evalFollowedByNode.getContext().getStatementContext().getPatternSubexpressionPoolSvc();
                poolSvc.getEngineSvc().decreaseCount(evalFollowedByNode);
                poolSvc.getStmtHandler().decreaseCount();
            }
        }

        // the node may already have quit as a result of an outer state quitting this state,
        // however the callback may still be received; It is fine to ignore this callback.
        if (index == null)
        {
            return;
        }

        // If the match came from the very last filter, need to escalate
        int numChildNodes = evalFollowedByNode.getChildNodes().length;
        if (index == (numChildNodes - 1))
        {
            boolean isFollowedByQuitted = false;
            if (nodes.isEmpty())
            {
                isFollowedByQuitted = true;
            }

            this.getParentEvaluator().evaluateTrue(matchEvent, this, isFollowedByQuitted);
        }
        // Else start a new sub-expression for the next-in-line filter
        else
        {
            PatternSubexpressionPoolStmtSvc poolSvc = evalFollowedByNode.getContext().getStatementContext().getPatternSubexpressionPoolSvc();
            boolean allow = poolSvc.getEngineSvc().tryIncreaseCount(evalFollowedByNode);
            if (!allow) {
                return;
            }
            poolSvc.getStmtHandler().increaseCount();

            EvalNode child = evalFollowedByNode.getChildNodes()[index + 1];
            EvalStateNode childState = child.newState(this, matchEvent, null);
            nodes.put(childState, index + 1);
            childState.start();
View Full Code Here

    {
        fromNode.quit();
        Integer index = nodes.remove(fromNode);

        if (index != null && index > 0) {
            PatternSubexpressionPoolStmtSvc poolSvc = evalFollowedByNode.getContext().getStatementContext().getPatternSubexpressionPoolSvc();
            poolSvc.getEngineSvc().decreaseCount(evalFollowedByNode);
            poolSvc.getStmtHandler().decreaseCount();
        }

        if (nodes.isEmpty())
        {
            this.getParentEvaluator().evaluateFalse(this);
View Full Code Here

    {
        for (Map.Entry<EvalStateNode, Integer> entry : nodes.entrySet())
        {
            entry.getKey().quit();
            if (entry.getValue() > 0) {
                PatternSubexpressionPoolStmtSvc poolSvc = evalFollowedByNode.getContext().getStatementContext().getPatternSubexpressionPoolSvc();
                poolSvc.getEngineSvc().decreaseCount(evalFollowedByNode);
                poolSvc.getStmtHandler().decreaseCount();
            }
        }
    }
View Full Code Here

                statementAgentInstanceRegistry = contextDescriptor.getAiResourceRegistryFactory().make();
            }
        }

        boolean countSubexpressions = engineServices.getConfigSnapshot().getEngineDefaults().getPatterns().getMaxSubexpressions() != null;
        PatternSubexpressionPoolStmtSvc patternSubexpressionPoolStmtSvc = null;
        if (countSubexpressions) {
            PatternSubexpressionPoolStmtHandler stmtCounter = new PatternSubexpressionPoolStmtHandler();
            patternSubexpressionPoolStmtSvc = new PatternSubexpressionPoolStmtSvc(engineServices.getPatternSubexpressionPoolSvc(), stmtCounter);
            engineServices.getPatternSubexpressionPoolSvc().addPatternContext(statementName, stmtCounter);
        }

        AgentInstanceScriptContext defaultAgentInstanceScriptContext = null;
        if (statementSpecRaw.getScriptExpressions() != null && !statementSpecRaw.getScriptExpressions().isEmpty()) {
View Full Code Here

            if (index != null && index > 0) {
                if (evalFollowedByNode.isTrackWithMax()) {
                    countActivePerChild[index - 1]--;
                }
                if (evalFollowedByNode.isTrackWithPool()) {
                    PatternSubexpressionPoolStmtSvc poolSvc = evalFollowedByNode.getContext().getStatementContext().getPatternSubexpressionPoolSvc();
                    poolSvc.getEngineSvc().decreaseCount(evalFollowedByNode);
                    poolSvc.getStmtHandler().decreaseCount();
                }
            }
        }

        // the node may already have quit as a result of an outer state quitting this state,
        // however the callback may still be received; It is fine to ignore this callback.
        if (index == null)
        {
            return;
        }

        // If the match came from the very last filter, need to escalate
        int numChildNodes = evalFollowedByNode.getChildNodes().length;
        if (index == (numChildNodes - 1))
        {
            boolean isFollowedByQuitted = false;
            if (nodes.isEmpty())
            {
                isFollowedByQuitted = true;
            }

            this.getParentEvaluator().evaluateTrue(matchEvent, this, isFollowedByQuitted);
        }
        // Else start a new sub-expression for the next-in-line filter
        else
        {
            if (evalFollowedByNode.isTrackWithMax()) {
                int max = evalFollowedByNode.getFactoryNode().getMax(index);
                if ((max != -1) && (max >=0)) {
                    if (countActivePerChild[index] >= max) {
                        evalFollowedByNode.getContext().getAgentInstanceContext().getStatementContext().getExceptionHandlingService().handleCondition(new ConditionPatternSubexpressionMax(max), evalFollowedByNode.getContext().getAgentInstanceContext().getStatementContext().getEpStatementHandle());
                        return;
                    }
                }
            }

            if (evalFollowedByNode.isTrackWithPool()) {
                PatternSubexpressionPoolStmtSvc poolSvc = evalFollowedByNode.getContext().getStatementContext().getPatternSubexpressionPoolSvc();
                boolean allow = poolSvc.getEngineSvc().tryIncreaseCount(evalFollowedByNode);
                if (!allow) {
                    return;
                }
                poolSvc.getStmtHandler().increaseCount();
            }

            if (evalFollowedByNode.isTrackWithMax()) {
                countActivePerChild[index]++;
            }
View Full Code Here

TOP

Related Classes of com.espertech.esper.pattern.pool.PatternSubexpressionPoolStmtSvc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.