本文整理汇总了Java中com.espertech.esper.core.service.EPServicesContext类的典型用法代码示例。如果您正苦于以下问题:Java EPServicesContext类的具体用法?Java EPServicesContext怎么用?Java EPServicesContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EPServicesContext类属于com.espertech.esper.core.service包,在下文中一共展示了EPServicesContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setContext
import com.espertech.esper.core.service.EPServicesContext; //导入依赖的package包/类
public void setContext(EPRuntime runtime, EPServicesContext servicesContext) {
MetricExecutionContext metricsExecutionContext = new MetricExecutionContext(servicesContext, runtime, stmtMetricRepository);
// create all engine and statement executions
metricExecEngine = new MetricExecEngine(this, engineUri, schedule, specification.getEngineInterval());
metricExecStmtGroupDefault = new MetricExecStatement(this, schedule, specification.getStatementInterval(), 0);
int countGroups = 1;
for (Map.Entry<String, ConfigurationMetricsReporting.StmtGroupMetrics> entry : specification.getStatementGroups().entrySet()) {
ConfigurationMetricsReporting.StmtGroupMetrics config = entry.getValue();
MetricExecStatement metricsExecution = new MetricExecStatement(this, schedule, config.getInterval(), countGroups);
this.statementGroupExecutions.put(entry.getKey(), metricsExecution);
countGroups++;
}
// last assign this volatile variable so the time event processing may schedule callbacks
executionContext = metricsExecutionContext;
}
示例2: addStartGraph
import com.espertech.esper.core.service.EPServicesContext; //导入依赖的package包/类
public synchronized void addStartGraph(CreateDataFlowDesc desc, StatementContext statementContext, EPServicesContext servicesContext, AgentInstanceContext agentInstanceContext, boolean newStatement) throws ExprValidationException {
compileTimeValidate(desc);
DataFlowServiceEntry existing = graphs.get(desc.getGraphName());
if (existing != null && (existing.getState() == EPStatementState.STARTED || newStatement)) {
throw new ExprValidationException("Data flow by name '" + desc.getGraphName() + "' has already been declared");
}
if (existing != null) {
existing.setState(EPStatementState.STARTED);
return;
}
// compile annotations
Map<GraphOperatorSpec, Annotation[]> operatorAnnotations = new HashMap<GraphOperatorSpec, Annotation[]>();
for (GraphOperatorSpec spec : desc.getOperators()) {
Annotation[] operatorAnnotation = AnnotationUtil.compileAnnotations(spec.getAnnotations(), servicesContext.getEngineImportService(), null);
operatorAnnotations.put(spec, operatorAnnotation);
}
DataFlowStmtDesc stmtDesc = new DataFlowStmtDesc(desc, statementContext, servicesContext, agentInstanceContext, operatorAnnotations);
graphs.put(desc.getGraphName(), new DataFlowServiceEntry(stmtDesc, EPStatementState.STARTED));
}
示例3: determineGraphDeclaredOutputPorts
import com.espertech.esper.core.service.EPServicesContext; //导入依赖的package包/类
private List<LogicalChannelProducingPortDeclared> determineGraphDeclaredOutputPorts(Object operator, int producingOpNum, OperatorMetadataDescriptor metadata, Map<String, EventType> types, EPServicesContext servicesContext)
throws ExprValidationException {
List<LogicalChannelProducingPortDeclared> ports = new ArrayList<LogicalChannelProducingPortDeclared>();
int portNumber = 0;
for (GraphOperatorOutputItem outputItem : metadata.getOperatorSpec().getOutput().getItems()) {
if (outputItem.getTypeInfo().size() > 1) {
throw new ExprValidationException("Multiple parameter types are not supported");
}
if (!outputItem.getTypeInfo().isEmpty()) {
GraphTypeDesc typeDesc = determineTypeOutputPort(outputItem.getTypeInfo().get(0), types, servicesContext);
boolean isDeclaredPunctuated = JavaClassHelper.isAnnotationListed(DataFlowOpProvideSignal.class, operator.getClass().getAnnotations());
ports.add(new LogicalChannelProducingPortDeclared(producingOpNum, metadata.getOperatorPrettyPrint(), outputItem.getStreamName(), portNumber, typeDesc, isDeclaredPunctuated));
}
portNumber++;
}
return ports;
}
示例4: determineTypeOutputPort
import com.espertech.esper.core.service.EPServicesContext; //导入依赖的package包/类
private static GraphTypeDesc determineTypeOutputPort(GraphOperatorOutputItemType outType, Map<String, EventType> types, EPServicesContext servicesContext)
throws ExprValidationException {
EventType eventType = null;
boolean isWildcard = false;
boolean isUnderlying = true;
String typeOrClassname = outType.getTypeOrClassname();
if (typeOrClassname != null && typeOrClassname.toLowerCase(Locale.ENGLISH).equals(EVENT_WRAPPED_TYPE)) {
isUnderlying = false;
if (!outType.getTypeParameters().isEmpty() && !outType.getTypeParameters().get(0).isWildcard()) {
String typeName = outType.getTypeParameters().get(0).getTypeOrClassname();
eventType = resolveType(typeName, types, servicesContext);
} else {
isWildcard = true;
}
} else if (typeOrClassname != null) {
eventType = resolveType(typeOrClassname, types, servicesContext);
} else {
isWildcard = true;
}
return new GraphTypeDesc(isWildcard, isUnderlying, eventType);
}
示例5: StatementAgentInstanceFactoryOnTriggerTable
import com.espertech.esper.core.service.EPServicesContext; //导入依赖的package包/类
public StatementAgentInstanceFactoryOnTriggerTable(StatementContext statementContext, StatementSpecCompiled statementSpec, EPServicesContext services, ViewableActivator activator, SubSelectStrategyCollection subSelectStrategyCollection, ResultSetProcessorFactoryDesc resultSetProcessorPrototype, ExprNode validatedJoin, TableOnViewFactory onExprFactory, EventType activatorResultEventType, TableMetadata tableMetadata, ResultSetProcessorFactoryDesc outputResultSetProcessorPrototype, OutputProcessViewFactory outputProcessViewFactory)
throws ExprValidationException {
super(statementContext, statementSpec, services, activator, subSelectStrategyCollection);
this.resultSetProcessorPrototype = resultSetProcessorPrototype;
this.onExprFactory = onExprFactory;
this.outputResultSetProcessorPrototype = outputResultSetProcessorPrototype;
this.outputProcessViewFactory = outputProcessViewFactory;
StatementAgentInstanceFactoryOnTriggerNamedWindow.IndexHintPair pair = StatementAgentInstanceFactoryOnTriggerNamedWindow.getIndexHintPair(statementContext, statementSpec);
IndexHint indexHint = pair.getIndexHint();
ExcludePlanHint excludePlanHint = pair.getExcludePlanHint();
queryPlanResult = SubordinateQueryPlanner.planOnExpression(
validatedJoin, activatorResultEventType, indexHint, true, -1, excludePlanHint,
false, tableMetadata.getEventTableIndexMetadataRepo(), tableMetadata.getInternalEventType(),
tableMetadata.getUniqueKeyProps(), true, statementContext.getStatementName(), statementContext.getStatementId(), statementContext.getAnnotations(), statementContext.getEngineImportService());
if (queryPlanResult.getIndexDescs() != null) {
for (int i = 0; i < queryPlanResult.getIndexDescs().length; i++) {
tableMetadata.addIndexReference(queryPlanResult.getIndexDescs()[i].getIndexName(), statementContext.getStatementName());
}
}
SubordinateQueryPlannerUtil.queryPlanLogOnExpr(tableMetadata.isQueryPlanLogging(), TableServiceImpl.getQueryPlanLog(),
queryPlanResult, statementContext.getAnnotations(), statementContext.getEngineImportService());
}
示例6: StatementAgentInstanceFactoryCreateWindow
import com.espertech.esper.core.service.EPServicesContext; //导入依赖的package包/类
public StatementAgentInstanceFactoryCreateWindow(StatementContext statementContext, StatementSpecCompiled statementSpec, EPServicesContext services, ViewableActivator activator, ViewFactoryChain unmaterializedViewChain, ResultSetProcessorFactoryDesc resultSetProcessorPrototype, OutputProcessViewFactory outputProcessViewFactory, boolean recoveringStatement) {
super(statementContext.getAnnotations());
this.statementContext = statementContext;
this.statementSpec = statementSpec;
this.services = services;
this.activator = activator;
this.unmaterializedViewChain = unmaterializedViewChain;
this.resultSetProcessorPrototype = resultSetProcessorPrototype;
this.outputProcessViewFactory = outputProcessViewFactory;
isRecoveringStatement = recoveringStatement;
if (statementSpec.getCreateWindowDesc().getInsertFilter() != null) {
createWindowInsertFilter = ExprNodeCompiler.allocateEvaluator(statementSpec.getCreateWindowDesc().getInsertFilter().getForge(), statementContext.getEngineImportService(), StatementAgentInstanceFactoryCreateWindow.class, false, statementContext.getStatementName());
} else {
createWindowInsertFilter = null;
}
}
示例7: StatementAgentInstanceFactorySelect
import com.espertech.esper.core.service.EPServicesContext; //导入依赖的package包/类
public StatementAgentInstanceFactorySelect(int numStreams, ViewableActivator[] eventStreamParentViewableActivators, StatementContext statementContext, StatementSpecCompiled statementSpec, EPServicesContext services, StreamTypeService typeService, ViewFactoryChain[] unmaterializedViewChain, ResultSetProcessorFactoryDesc resultSetProcessorFactoryDesc, StreamJoinAnalysisResult joinAnalysisResult, boolean recoveringResilient, JoinSetComposerPrototype joinSetComposerPrototype, SubSelectStrategyCollection subSelectStrategyCollection, ViewResourceDelegateVerified viewResourceDelegate, OutputProcessViewFactory outputProcessViewFactory) {
super(statementSpec.getAnnotations());
this.numStreams = numStreams;
this.eventStreamParentViewableActivators = eventStreamParentViewableActivators;
this.statementContext = statementContext;
this.statementSpec = statementSpec;
this.services = services;
this.typeService = typeService;
this.unmaterializedViewChain = unmaterializedViewChain;
this.resultSetProcessorFactoryDesc = resultSetProcessorFactoryDesc;
this.joinAnalysisResult = joinAnalysisResult;
this.joinSetComposerPrototype = joinSetComposerPrototype;
this.subSelectStrategyCollection = subSelectStrategyCollection;
this.viewResourceDelegate = viewResourceDelegate;
this.outputProcessViewFactory = outputProcessViewFactory;
if (statementSpec.getFilterRootNode() != null) {
filterRootNodeEvaluator = ExprNodeCompiler.allocateEvaluator(statementSpec.getFilterRootNode().getForge(), statementContext.getEngineImportService(), StatementAgentInstanceFactorySelect.class, false, statementContext.getStatementName());
} else {
filterRootNodeEvaluator = null;
}
}
示例8: addContextSpec
import com.espertech.esper.core.service.EPServicesContext; //导入依赖的package包/类
public void addContextSpec(EPServicesContext servicesContext, AgentInstanceContext agentInstanceContext, CreateContextDesc contextDesc, boolean isRecoveringResilient, EventType statementResultEventType) throws ExprValidationException {
ContextManagerEntry mgr = contexts.get(contextDesc.getContextName());
if (mgr != null) {
if (destroyedContexts.contains(contextDesc.getContextName())) {
throw new ExprValidationException("Context by name '" + contextDesc.getContextName() + "' is still referenced by statements and may not be changed");
}
throw new ExprValidationException("Context by name '" + contextDesc.getContextName() + "' already exists");
}
ContextControllerFactoryServiceContext factoryServiceContext = new ContextControllerFactoryServiceContext(contextDesc.getContextName(), servicesContext, contextDesc.getContextDetail(), agentInstanceContext, isRecoveringResilient, statementResultEventType);
ContextManager contextManager = servicesContext.getContextManagerFactoryService().make(contextDesc.getContextDetail(), factoryServiceContext);
factoryServiceContext.getAgentInstanceContextCreate().getEpStatementAgentInstanceHandle().setFilterFaultHandler(contextManager);
contexts.put(contextDesc.getContextName(), new ContextManagerEntry(contextManager));
ContextStateEventUtil.dispatchContext(listeners, () -> new ContextStateEventContextCreated(servicesContext.getEngineURI(), contextDesc.getContextName()), ContextStateListener::onContextCreated);
}
示例9: startInternal
import com.espertech.esper.core.service.EPServicesContext; //导入依赖的package包/类
public EPStatementStartResult startInternal(final EPServicesContext services, StatementContext statementContext, boolean isNewStatement, boolean isRecoveringStatement, boolean isRecoveringResilient) throws ExprValidationException, ViewProcessingException {
final CreateDataFlowDesc createGraphDesc = statementSpec.getCreateGraphDesc();
final AgentInstanceContext agentInstanceContext = getDefaultAgentInstanceContext(statementContext);
// define output event type
String typeName = "EventType_Graph_" + createGraphDesc.getGraphName();
EventType resultType = services.getEventAdapterService().createAnonymousMapType(typeName, Collections.<String, Object>emptyMap(), true);
services.getDataFlowService().addStartGraph(createGraphDesc, statementContext, services, agentInstanceContext, isNewStatement);
EPStatementStopMethod stopMethod = new EPStatementStopMethod() {
public void stop() {
services.getDataFlowService().stopGraph(createGraphDesc.getGraphName());
}
};
EPStatementDestroyMethod destroyMethod = new EPStatementDestroyMethod() {
public void destroy() {
services.getDataFlowService().removeGraph(createGraphDesc.getGraphName());
}
};
ZeroDepthStreamNoIterate resultView = new ZeroDepthStreamNoIterate(resultType);
statementContext.setStatementAgentInstanceFactory(new StatementAgentInstanceFactoryNoAgentInstance(resultView));
return new EPStatementStartResult(resultView, stopMethod, destroyMethod);
}
示例10: validateResolveProcessor
import com.espertech.esper.core.service.EPServicesContext; //导入依赖的package包/类
public static FireAndForgetProcessor validateResolveProcessor(StreamSpecCompiled streamSpec, EPServicesContext services)
throws ExprValidationException {
// resolve processor
String processorName;
if (streamSpec instanceof NamedWindowConsumerStreamSpec) {
NamedWindowConsumerStreamSpec namedSpec = (NamedWindowConsumerStreamSpec) streamSpec;
processorName = namedSpec.getWindowName();
} else {
TableQueryStreamSpec tableSpec = (TableQueryStreamSpec) streamSpec;
processorName = tableSpec.getTableName();
}
// get processor instance
TableMetadata tableMetadata = services.getTableService().getTableMetadata(processorName);
if (tableMetadata != null) {
return new FireAndForgetProcessorTable(services.getTableService(), tableMetadata);
} else {
NamedWindowProcessor nwprocessor = services.getNamedWindowMgmtService().getProcessor(processorName);
if (nwprocessor == null) {
throw new ExprValidationException("A table or named window by name '" + processorName + "' does not exist");
}
return new FireAndForgetProcessorNamedWindow(nwprocessor);
}
}
示例11: attachTableAccess
import com.espertech.esper.core.service.EPServicesContext; //导入依赖的package包/类
public static Map<ExprTableAccessNode, ExprTableAccessEvalStrategy> attachTableAccess(EPServicesContext services, AgentInstanceContext agentInstanceContext, ExprTableAccessNode[] tableNodes, boolean isFireAndForget) {
if (tableNodes == null || tableNodes.length == 0) {
return Collections.emptyMap();
}
Map<ExprTableAccessNode, ExprTableAccessEvalStrategy> strategies = new HashMap<ExprTableAccessNode, ExprTableAccessEvalStrategy>();
for (ExprTableAccessNode tableNode : tableNodes) {
boolean writesToTables = agentInstanceContext.getStatementContext().isWritesToTables();
TableAndLockProvider provider = services.getTableService().getStateProvider(tableNode.getTableName(), agentInstanceContext.getAgentInstanceId(), writesToTables);
TableMetadata tableMetadata = services.getTableService().getTableMetadata(tableNode.getTableName());
ExprTableAccessEvalStrategy strategy = ExprTableEvalStrategyFactory.getTableAccessEvalStrategy(tableNode, provider, tableMetadata, isFireAndForget);
strategies.put(tableNode, strategy);
}
return strategies;
}
示例12: startInternal
import com.espertech.esper.core.service.EPServicesContext; //导入依赖的package包/类
public EPStatementStartResult startInternal(final EPServicesContext services, StatementContext statementContext, boolean isNewStatement, boolean isRecoveringStatement, boolean isRecoveringResilient) throws ExprValidationException, ViewProcessingException {
String expressionName = services.getExprDeclaredService().addExpressionOrScript(statementSpec.getCreateExpressionDesc());
// define output event type
String typeName = "EventType_Expression_" + expressionName;
EventType resultType = services.getEventAdapterService().createAnonymousMapType(typeName, Collections.<String, Object>emptyMap(), true);
EPStatementStopMethod stopMethod = new EPStatementStopMethod() {
public void stop() {
// no action
}
};
EPStatementDestroyMethod destroyMethod = new EPStatementDestroyMethod() {
public void destroy() {
services.getExprDeclaredService().destroyedExpression(statementSpec.getCreateExpressionDesc());
}
};
Viewable resultView = new ZeroDepthStreamNoIterate(resultType);
statementContext.setStatementAgentInstanceFactory(new StatementAgentInstanceFactoryNoAgentInstance(resultView));
return new EPStatementStartResult(resultView, stopMethod, destroyMethod);
}
示例13: startInternal
import com.espertech.esper.core.service.EPServicesContext; //导入依赖的package包/类
public EPStatementStartResult startInternal(final EPServicesContext services, final StatementContext statementContext, boolean isNewStatement, boolean isRecoveringStatement, boolean isRecoveringResilient) throws ExprValidationException, ViewProcessingException {
final CreateSchemaDesc spec = statementSpec.getCreateSchemaDesc();
EPLValidationUtil.validateTableExists(services.getTableService(), spec.getSchemaName());
EventType eventType = handleCreateSchema(services, statementContext, spec);
// enter a reference
services.getStatementEventTypeRefService().addReferences(statementContext.getStatementName(), new String[]{spec.getSchemaName()});
final EventType allocatedEventType = eventType;
EPStatementStopMethod stopMethod = new EPStatementStopMethod() {
public void stop() {
services.getStatementEventTypeRefService().removeReferencesStatement(statementContext.getStatementName());
if (services.getStatementEventTypeRefService().getStatementNamesForType(spec.getSchemaName()).isEmpty()) {
services.getEventAdapterService().removeType(allocatedEventType.getName());
services.getFilterService().removeType(allocatedEventType);
}
}
};
Viewable viewable = new ViewableDefaultImpl(eventType);
// assign agent instance factory (an empty op)
statementContext.setStatementAgentInstanceFactory(new StatementAgentInstanceFactoryNoAgentInstance(viewable));
return new EPStatementStartResult(viewable, stopMethod, null);
}
示例14: initThreading
import com.espertech.esper.core.service.EPServicesContext; //导入依赖的package包/类
public void initThreading(EPServicesContext services, EPRuntimeImpl runtime) {
if (isInboundThreading) {
inboundQueue = makeQueue(config.getThreadPoolInboundCapacity());
inboundThreadPool = getThreadPool(services.getEngineURI(), "Inbound", inboundQueue, config.getThreadPoolInboundNumThreads());
}
if (isTimerThreading) {
timerQueue = makeQueue(config.getThreadPoolTimerExecCapacity());
timerThreadPool = getThreadPool(services.getEngineURI(), "TimerExec", timerQueue, config.getThreadPoolTimerExecNumThreads());
}
if (isRouteThreading) {
routeQueue = makeQueue(config.getThreadPoolRouteExecCapacity());
routeThreadPool = getThreadPool(services.getEngineURI(), "RouteExec", routeQueue, config.getThreadPoolRouteExecNumThreads());
}
if (isOutboundThreading) {
outboundQueue = makeQueue(config.getThreadPoolOutboundCapacity());
outboundThreadPool = getThreadPool(services.getEngineURI(), "Outbound", outboundQueue, config.getThreadPoolOutboundNumThreads());
}
}
示例15: setContext
import com.espertech.esper.core.service.EPServicesContext; //导入依赖的package包/类
public void setContext(EPRuntime runtime, EPServicesContext servicesContext)
{
MetricExecutionContext metricsExecutionContext = new MetricExecutionContext(servicesContext, runtime, stmtMetricRepository);
// create all engine and statement executions
metricExecEngine = new MetricExecEngine(this, engineUri, schedule, specification.getEngineInterval());
metricExecStmtGroupDefault = new MetricExecStatement(this, schedule, specification.getStatementInterval(), 0);
int countGroups = 1;
for (Map.Entry<String, ConfigurationMetricsReporting.StmtGroupMetrics> entry : specification.getStatementGroups().entrySet())
{
ConfigurationMetricsReporting.StmtGroupMetrics config = entry.getValue();
MetricExecStatement metricsExecution = new MetricExecStatement(this, schedule, config.getInterval(), countGroups);
this.statementGroupExecutions.put(entry.getKey(), metricsExecution);
countGroups++;
}
// last assign this volatile variable so the time event processing may schedule callbacks
executionContext = metricsExecutionContext;
}