Examples of StatementAgentInstanceFactoryResult


Examples of com.espertech.esper.core.context.factory.StatementAgentInstanceFactoryResult

        StatementAgentInstanceLock statementAgentInstanceLock = agentInstanceContext.getEpStatementAgentInstanceHandle().getStatementAgentInstanceLock();
        statementAgentInstanceLock.acquireWriteLock(null);

        try {
            // start
            StatementAgentInstanceFactoryResult startResult = statement.getFactory().newContext(agentInstanceContext, isRecoveringResilient);

            // hook up with listeners+subscribers
            startResult.getFinalView().addView(statement.getMergeView()); // hook output to merge view

            // assign agents for expression-node based strategies
            AIRegistryExpr aiExprSvc = statementContext.getStatementAgentInstanceRegistry().getAgentInstanceExprService();
            AIRegistryAggregation aiAggregationSvc = statementContext.getStatementAgentInstanceRegistry().getAgentInstanceAggregationService();

            // allocate aggregation service
            if (startResult.getOptionalAggegationService() != null) {
                aiAggregationSvc.assignService(agentInstanceId, startResult.getOptionalAggegationService());
            }

            // allocate subquery
            for (Map.Entry<ExprSubselectNode, SubSelectStrategyHolder> item : startResult.getSubselectStrategies().entrySet()) {
                ExprSubselectNode node = item.getKey();
                SubSelectStrategyHolder strategyHolder = item.getValue();

                aiExprSvc.getSubselectService(node).assignService(agentInstanceId, strategyHolder.getStategy());
                aiExprSvc.getSubselectAggregationService(node).assignService(agentInstanceId, strategyHolder.getSubselectAggregationService());

                // allocate prior within subquery
                for (Map.Entry<ExprPriorNode, ExprPriorEvalStrategy> priorEntry : strategyHolder.getPriorStrategies().entrySet()) {
                    aiExprSvc.getPriorServices(priorEntry.getKey()).assignService(agentInstanceId, priorEntry.getValue());
                }

                // allocate previous within subquery
                for (Map.Entry<ExprPreviousNode, ExprPreviousEvalStrategy> prevEntry : strategyHolder.getPreviousNodeStrategies().entrySet()) {
                    aiExprSvc.getPreviousServices(prevEntry.getKey()).assignService(agentInstanceId, prevEntry.getValue());
                }
            }

            // allocate prior-expressions
            for (Map.Entry<ExprPriorNode, ExprPriorEvalStrategy> item : startResult.getPriorNodeStrategies().entrySet()) {
                aiExprSvc.getPriorServices(item.getKey()).assignService(agentInstanceId, item.getValue());
            }

            // allocate previous-expressions
            for (Map.Entry<ExprPreviousNode, ExprPreviousEvalStrategy> item : startResult.getPreviousNodeStrategies().entrySet()) {
                aiExprSvc.getPreviousServices(item.getKey()).assignService(agentInstanceId, item.getValue());
            }

            // execute preloads, if any
            for (StatementAgentInstancePreload preload : startResult.getPreloadList()) {
                preload.executePreload();
            }

            if (statementContext.getExtensionServicesContext() != null) {
                statementContext.getExtensionServicesContext().startContextPartition(startResult, agentInstanceId);
View Full Code Here

Examples of com.espertech.esper.core.context.factory.StatementAgentInstanceFactoryResult

        contextProperties.put(ContextPropertyEventType.PROP_CTX_NAME, contextName);
        contextProperties.put(ContextPropertyEventType.PROP_CTX_ID, contextId);
        MappedEventBean contextBean = (MappedEventBean) servicesContext.getEventAdapterService().adapterForTypedMap(contextProperties, contextDescriptor.getContextPropertyRegistry().getContextEventType());

        // activate
        StatementAgentInstanceFactoryResult result = StatementAgentInstanceUtil.start(servicesContext, statementDesc.getStatement(), false, contextId, contextBean, proxy, isRecoveringResilient);

        // save only instance data
        return new AgentInstance(result.getStopCallback(), result.getAgentInstanceContext(), result.getFinalView());
    }
View Full Code Here

Examples of com.espertech.esper.core.context.factory.StatementAgentInstanceFactoryResult

        properties.put(ContextPropertyEventType.PROP_CTX_NAME, contextName);
        properties.put(ContextPropertyEventType.PROP_CTX_ID, contextId);
        MappedEventBean contextBean = (MappedEventBean) servicesContext.getEventAdapterService().adapterForTypedMap(properties, contextDescriptor.getContextPropertyRegistry().getContextEventType());

        // activate
        StatementAgentInstanceFactoryResult result = StatementAgentInstanceUtil.start(servicesContext, statementDesc.getStatement(), false, contextId, contextBean, proxy, isRecoveringResilient);
        return new AgentInstance(result.getStopCallback(), result.getAgentInstanceContext(), result.getFinalView());
    }
View Full Code Here

Examples of com.espertech.esper.core.context.factory.StatementAgentInstanceFactoryResult

        contextProperties.put(ContextPropertyEventType.PROP_CTX_NAME, contextName);
        contextProperties.put(ContextPropertyEventType.PROP_CTX_ID, contextId);
        MappedEventBean contextBean = (MappedEventBean) servicesContext.getEventAdapterService().adapterForTypedMap(contextProperties, contextDescriptor.getContextPropertyRegistry().getContextEventType());

        // activate
        StatementAgentInstanceFactoryResult result = StatementAgentInstanceUtil.start(servicesContext, statementDesc.getStatement(), false, contextId, contextBean, proxy, isRecoveringResilient);

        // save only instance data
        return new AgentInstance(result.getStopCallback(), result.getAgentInstanceContext(), result.getFinalView());
    }
View Full Code Here

Examples of com.espertech.esper.core.context.factory.StatementAgentInstanceFactoryResult

        // create agent instance context
        AgentInstanceContext agentInstanceContext = new AgentInstanceContext(statementContext, agentInstanceHandle, new int[] {agentInstanceId}, agentInstanceFilterProxy, agentInstanceProperties);

        // start
        StatementAgentInstanceFactoryResult startResult = statement.getFactory().newContext(agentInstanceContext);

        // hook up with listeners+subscribers
        startResult.getFinalView().addView(statement.getMergeView()); // hook output to merge view

        // assign agents for expression-node based strategies
        AIRegistryExpr aiExprSvc = statementContext.getStatementAgentInstanceRegistry().getAgentInstanceExprService();
        AIRegistryAggregation aiAggregationSvc = statementContext.getStatementAgentInstanceRegistry().getAgentInstanceAggregationService();

        // allocate aggregation service
        if (startResult.getOptionalAggegationService() != null) {
            aiAggregationSvc.assignService(agentInstanceId, startResult.getOptionalAggegationService());
        }

        // allocate subquery
        for (Map.Entry<ExprSubselectNode, SubSelectStrategyHolder> item : startResult.getSubselectStrategies().entrySet()) {
            ExprSubselectNode node = item.getKey();
            SubSelectStrategyHolder strategyHolder = item.getValue();

            aiExprSvc.getSubselectService(node).assignService(agentInstanceId, strategyHolder.getStategy());

            // allocate prior within subquery
            for (Map.Entry<ExprPriorNode, ExprPriorEvalStrategy> priorEntry : strategyHolder.getPriorStrategies().entrySet()) {
                aiExprSvc.getPriorServices(priorEntry.getKey()).assignService(agentInstanceId, priorEntry.getValue());
            }

            // allocate previous within subquery
            for (Map.Entry<ExprPreviousNode, ExprPreviousEvalStrategy> prevEntry : strategyHolder.getPreviousNodeStrategies().entrySet()) {
                aiExprSvc.getPreviousServices(prevEntry.getKey()).assignService(agentInstanceId, prevEntry.getValue());
            }
        }

        // allocate prior-expressions
        for (Map.Entry<ExprPriorNode, ExprPriorEvalStrategy> item : startResult.getPriorNodeStrategies().entrySet()) {
            aiExprSvc.getPriorServices(item.getKey()).assignService(agentInstanceId, item.getValue());
        }

        // allocate previous-expressions
        for (Map.Entry<ExprPreviousNode, ExprPreviousEvalStrategy> item : startResult.getPreviousNodeStrategies().entrySet()) {
            aiExprSvc.getPreviousServices(item.getKey()).assignService(agentInstanceId, item.getValue());
        }

        // instantiate
        return startResult;
View Full Code Here

Examples of com.espertech.esper.core.context.factory.StatementAgentInstanceFactoryResult

        // retro-actively create contexts for that statement
        for (Map.Entry<Object, Integer> entry : partitionKeys.entrySet()) {
            Object key = entry.getKey();
            Integer agentInstanceId = entry.getValue();

            StatementAgentInstanceFactoryResult result = startContextStatement(contextDescriptor.getContextPropertyRegistry().getContextEventType(), contextName, servicesContext, key, desc, agentInstanceId, segmentedSpec);

            AgentInstance instance = new AgentInstance(result.getStopCallback(), result.getAgentInstanceContext(), result.getFinalView());
            desc.getInstances().add(instance);
        }
    }
View Full Code Here

Examples of com.espertech.esper.core.context.factory.StatementAgentInstanceFactoryResult

        // for all statements
        List<AgentInstance> newInstances = new ArrayList<AgentInstance>();
        for (Map.Entry<String, ContextManagerPartitionedStatementDesc> entry : statements.entrySet()) {
            ContextManagerPartitionedStatementDesc statementDesc = entry.getValue();

            StatementAgentInstanceFactoryResult startResult = startContextStatement(contextDescriptor.getContextPropertyRegistry().getContextEventType(), contextName, servicesContext, keyValue, statementDesc, agentInstanceId, segmentedSpec);

            AgentInstance instance = new AgentInstance(startResult.getStopCallback(), startResult.getAgentInstanceContext(), startResult.getFinalView());
            statementDesc.getInstances().add(instance);
            newInstances.add(instance);
        }

        // save new context state
View Full Code Here

Examples of com.espertech.esper.core.context.factory.StatementAgentInstanceFactoryResult

    }

    protected void startStatement(ContextManagedStatementBase statement) {

        EventBean contextProperties = ContextPropertyEventType.getTemporalFixedBean(servicesContext.getEventAdapterService(), contextDescriptor.getContextPropertyRegistry().getContextEventType(), contextName, startTime, endTime);
        StatementAgentInstanceFactoryResult startResult = StatementAgentInstanceUtil.start(servicesContext, statement, true, 0, contextProperties, AgentInstanceFilterProxyNull.AGENT_INSTANCE_FILTER_PROXY_NULL);
        instances.put(statement.getStatementContext().getStatementId(), new AgentInstance(startResult.getStopCallback(), startResult.getAgentInstanceContext(), startResult.getFinalView()));
    }
View Full Code Here

Examples of com.espertech.esper.core.context.factory.StatementAgentInstanceFactoryResult

            instanceList.add(ai);
        }
    }

    private AgentInstance startAgentInstance(ContextManagedStatementBase statement, int agentInstanceId, EventBean contextBean) {
        StatementAgentInstanceFactoryResult result = StatementAgentInstanceUtil.start(servicesContext, statement, false, agentInstanceId, contextBean, AgentInstanceFilterProxyNull.AGENT_INSTANCE_FILTER_PROXY_NULL);
        return new AgentInstance(result.getStopCallback(), result.getAgentInstanceContext(), result.getFinalView());
    }
View Full Code Here

Examples of com.espertech.esper.core.context.factory.StatementAgentInstanceFactoryResult

        // retro-actively create contexts for that statement
        for (Map.Entry<ContextDetailCategoryItem, Integer> entry : instances.entrySet()) {
            ContextDetailCategoryItem category = entry.getKey();
            Integer agentInstanceId = entry.getValue();

            StatementAgentInstanceFactoryResult result = startContextStatement(contextDescriptor, contextName, servicesContext, category, desc, agentInstanceId, categorySpec);
            AgentInstance agentInstance = new AgentInstance(result.getStopCallback(), result.getAgentInstanceContext(), result.getFinalView());
            desc.getInstances().add(agentInstance);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.