本文整理汇总了Java中com.espertech.esper.epl.named.NamedWindowProcessorInstance类的典型用法代码示例。如果您正苦于以下问题:Java NamedWindowProcessorInstance类的具体用法?Java NamedWindowProcessorInstance怎么用?Java NamedWindowProcessorInstance使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NamedWindowProcessorInstance类属于com.espertech.esper.epl.named包,在下文中一共展示了NamedWindowProcessorInstance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testLateConsumerNoIterate
import com.espertech.esper.epl.named.NamedWindowProcessorInstance; //导入依赖的package包/类
public void testLateConsumerNoIterate() throws Exception {
// client-side
epService.getEPAdministrator().createEPL("create window MyVDW.test:vdw() as SupportBean");
SupportVirtualDW window = (SupportVirtualDW) getFromContext("/virtualdw/MyVDW");
SupportBean supportBean = new SupportBean("E1", 100);
window.setData(Collections.singleton(supportBean));
EPStatement stmt = epService.getEPAdministrator().createEPL("select (select sum(intPrimitive) from MyVDW vdw where vdw.theString = s0.p00) from SupportBean_S0 s0");
stmt.addListener(listener);
VirtualDataWindowLookupContextSPI spiContext = (VirtualDataWindowLookupContextSPI) window.getLastRequestedIndex();
// CM side
epService.getEPAdministrator().createEPL("create window MyWin.std:unique(theString) as SupportBean");
epService.getEPAdministrator().createEPL("insert into MyWin select * from SupportBean");
NamedWindowProcessor processor = spi.getNamedWindowService().getProcessor("MyWin");
NamedWindowProcessorInstance processorInstance = processor.getProcessorInstance(null);
SubordTableLookupStrategy strategy = processorInstance.getRootViewInstance().getAddSubqueryLookupStrategy("ABC", "001", null, spiContext.getOuterTypePerStream(), spiContext.getJoinDesc(), spiContext.isForceTableScan(), 0, null);
epService.getEPRuntime().sendEvent(new SupportBean("E2", 200));
// trigger
epService.getEPRuntime().sendEvent(new SupportBean_S0(1, "E2"));
EventBean[] outerEvents = window.getLastAccessEvents();
Collection<EventBean> result = strategy.lookup(outerEvents, null);
assertTrue(!result.isEmpty());
}
示例2: getIndexInstanceRepo
import com.espertech.esper.epl.named.NamedWindowProcessorInstance; //导入依赖的package包/类
private EventTableIndexRepository getIndexInstanceRepo(EPServiceProvider epService, boolean namedWindow, String name) {
if (namedWindow) {
NamedWindowProcessorInstance instance = getNamedWindowMgmtService(epService).getProcessor(name).getProcessorInstanceNoContext();
return instance.getRootViewInstance().getIndexRepository();
}
TableMetadata metadata = getTableService(epService).getTableMetadata(name);
return metadata.getState(-1).getIndexRepository();
}
示例3: StatementAgentInstanceFactoryCreateWindowResult
import com.espertech.esper.epl.named.NamedWindowProcessorInstance; //导入依赖的package包/类
public StatementAgentInstanceFactoryCreateWindowResult(Viewable finalView, StopCallback stopCallback, AgentInstanceContext agentInstanceContext, Viewable eventStreamParentViewable, StatementAgentInstancePostLoad postLoad, Viewable topView, NamedWindowProcessorInstance processorInstance, ViewableActivationResult viewableActivationResult) {
super(finalView, stopCallback, agentInstanceContext,
null, Collections.<ExprSubselectNode, SubSelectStrategyHolder>emptyMap(),
Collections.<ExprPriorNode, ExprPriorEvalStrategy>emptyMap(),
Collections.<ExprPreviousNode, ExprPreviousEvalStrategy>emptyMap(),
null,
Collections.<ExprTableAccessNode, ExprTableAccessEvalStrategy>emptyMap(),
Collections.<StatementAgentInstancePreload>emptyList()
);
this.eventStreamParentViewable = eventStreamParentViewable;
this.postLoad = postLoad;
this.topView = topView;
this.processorInstance = processorInstance;
this.viewableActivationResult = viewableActivationResult;
}
示例4: getProcessorInstance
import com.espertech.esper.epl.named.NamedWindowProcessorInstance; //导入依赖的package包/类
public FireAndForgetInstance getProcessorInstance(AgentInstanceContext agentInstanceContext) {
NamedWindowProcessorInstance processorInstance = namedWindowProcessor.getProcessorInstance(agentInstanceContext);
if (processorInstance != null) {
return new FireAndForgetInstanceNamedWindow(processorInstance);
}
return null;
}
示例5: getProcessorInstanceContextById
import com.espertech.esper.epl.named.NamedWindowProcessorInstance; //导入依赖的package包/类
public FireAndForgetInstance getProcessorInstanceContextById(int agentInstanceId) {
NamedWindowProcessorInstance processorInstance = namedWindowProcessor.getProcessorInstance(agentInstanceId);
if (processorInstance != null) {
return new FireAndForgetInstanceNamedWindow(processorInstance);
}
return null;
}
示例6: getProcessorInstanceNoContext
import com.espertech.esper.epl.named.NamedWindowProcessorInstance; //导入依赖的package包/类
public FireAndForgetInstance getProcessorInstanceNoContext() {
NamedWindowProcessorInstance processorInstance = namedWindowProcessor.getProcessorInstanceNoContext();
if (processorInstance == null) {
return null;
}
return new FireAndForgetInstanceNamedWindow(processorInstance);
}
示例7: startInternal
import com.espertech.esper.epl.named.NamedWindowProcessorInstance; //导入依赖的package包/类
public EPStatementStartResult startInternal(EPServicesContext services, StatementContext statementContext, boolean isNewStatement, boolean isRecoveringStatement, boolean isRecoveringResilient) throws ExprValidationException, ViewProcessingException {
final CreateIndexDesc spec = statementSpec.getCreateIndexDesc();
final NamedWindowProcessor processor = services.getNamedWindowService().getProcessor(spec.getWindowName());
if (processor == null) {
throw new ExprValidationException("A named window by name '" + spec.getWindowName() + "' does not exist");
}
final NamedWindowProcessorInstance processorInstance = processor.getProcessorInstance(getDefaultAgentInstanceContext(statementContext));
EPStatementStopMethod stopMethod;
if (processor.isVirtualDataWindow()) {
final VirtualDWView virtualDWView = processorInstance.getRootViewInstance().getVirtualDataWindow();
virtualDWView.handleStartIndex(spec);
stopMethod = new EPStatementStopMethod() {
public void stop() {
virtualDWView.handleStopIndex(spec);
}
};
}
else {
processorInstance.getRootViewInstance().addExplicitIndex(spec.isUnique(), spec.getWindowName(), spec.getIndexName(), spec.getColumns());
stopMethod = new EPStatementStopMethod() {
public void stop()
{
processorInstance.getRootViewInstance().removeExplicitIndex(spec.getIndexName());
}
};
}
Viewable viewable = new ViewableDefaultImpl(processor.getNamedWindowType());
return new EPStatementStartResult(viewable, stopMethod, null);
}
示例8: getStreamFilterSnapshot
import com.espertech.esper.epl.named.NamedWindowProcessorInstance; //导入依赖的package包/类
private Collection<EventBean> getStreamFilterSnapshot(int streamNum, ContextPartitionSelector contextPartitionSelector) {
final StreamSpecCompiled streamSpec = statementSpec.getStreamSpecs().get(streamNum);
NamedWindowConsumerStreamSpec namedSpec = (NamedWindowConsumerStreamSpec) streamSpec;
NamedWindowProcessor namedWindowProcessor = processors[streamNum];
// handle the case of a single or matching agent instance
NamedWindowProcessorInstance processorInstance = namedWindowProcessor.getProcessorInstance(agentInstanceContext);
if (processorInstance != null) {
return getStreamSnapshotInstance(streamNum, namedSpec, processorInstance);
}
// context partition runtime query
Collection<Integer> contextPartitions;
if (contextPartitionSelector == null || contextPartitionSelector instanceof ContextPartitionSelectorAll) {
contextPartitions = namedWindowProcessor.getProcessorInstancesAll();
}
else {
ContextManager contextManager = services.getContextManagementService().getContextManager(namedWindowProcessor.getContextName());
contextPartitions = contextManager.getAgentInstanceIds(contextPartitionSelector);
}
// collect events
ArrayDeque<EventBean> events = new ArrayDeque<EventBean>();
for (int agentInstanceId : contextPartitions) {
processorInstance = namedWindowProcessor.getProcessorInstance(agentInstanceId);
if (processorInstance != null) {
Collection<EventBean> coll = processorInstance.getTailViewInstance().snapshot(filters[streamNum], statementSpec.getAnnotations());
events.addAll(coll);
}
}
return events;
}
示例9: getStreamSnapshotInstance
import com.espertech.esper.epl.named.NamedWindowProcessorInstance; //导入依赖的package包/类
private Collection<EventBean> getStreamSnapshotInstance(int streamNum, NamedWindowConsumerStreamSpec namedSpec, NamedWindowProcessorInstance processorInstance) {
Collection<EventBean> coll = processorInstance.getTailViewInstance().snapshot(filters[streamNum], statementSpec.getAnnotations());
if (namedSpec.getFilterExpressions().size() != 0) {
coll = getFiltered(coll, namedSpec.getFilterExpressions());
}
return coll;
}
示例10: instantiate
import com.espertech.esper.epl.named.NamedWindowProcessorInstance; //导入依赖的package包/类
public SubSelectStrategyRealization instantiate(EPServicesContext services,
Viewable viewableRoot,
AgentInstanceContext agentInstanceContext,
List<StopCallback> stopCallbackList,
int subqueryNumber, boolean isRecoveringResilient) {
SubselectAggregationPreprocessorBase subselectAggregationPreprocessor = null;
AggregationService aggregationService = null;
if (aggregationServiceFactory != null) {
aggregationService = aggregationServiceFactory.getAggregationServiceFactory().makeService(agentInstanceContext, agentInstanceContext.getEngineImportService(), true, subqueryNumber);
if (groupByKeys == null) {
if (filterExprEval == null) {
subselectAggregationPreprocessor = new SubselectAggregationPreprocessorUnfilteredUngrouped(aggregationService, filterExprEval, null);
} else {
subselectAggregationPreprocessor = new SubselectAggregationPreprocessorFilteredUngrouped(aggregationService, filterExprEval, null);
}
} else {
if (filterExprEval == null) {
subselectAggregationPreprocessor = new SubselectAggregationPreprocessorUnfilteredGrouped(aggregationService, filterExprEval, groupByKeys);
} else {
subselectAggregationPreprocessor = new SubselectAggregationPreprocessorFilteredGrouped(aggregationService, filterExprEval, groupByKeys);
}
}
}
SubordTableLookupStrategy subqueryLookup;
if (optionalNamedWindowProcessor != null) {
NamedWindowProcessorInstance instance = optionalNamedWindowProcessor.getProcessorInstance(agentInstanceContext);
if (queryPlan == null) {
if (instance.getRootViewInstance().isQueryPlanLogging() && NamedWindowRootView.getQueryPlanLog().isInfoEnabled()) {
NamedWindowRootView.getQueryPlanLog().info("shared, full table scan");
}
subqueryLookup = new SubordFullTableScanLookupStrategyLocking(instance.getRootViewInstance().getDataWindowContents(), agentInstanceContext.getEpStatementAgentInstanceHandle().getStatementAgentInstanceLock());
} else {
EventTable[] tables = null;
if (!optionalNamedWindowProcessor.isVirtualDataWindow()) {
tables = SubordinateQueryPlannerUtil.realizeTables(queryPlan.getIndexDescs(), instance.getRootViewInstance().getEventType(), instance.getRootViewInstance().getIndexRepository(), instance.getRootViewInstance().getDataWindowContents(), agentInstanceContext, isRecoveringResilient);
}
SubordTableLookupStrategy strategy = queryPlan.getLookupStrategyFactory().makeStrategy(tables, instance.getRootViewInstance().getVirtualDataWindow());
subqueryLookup = new SubordIndexedTableLookupStrategyLocking(strategy, instance.getTailViewInstance().getAgentInstanceContext().getAgentInstanceLock());
}
} else {
TableStateInstance state = tableService.getState(optionalTableMetadata.getTableName(), agentInstanceContext.getAgentInstanceId());
Lock lock = agentInstanceContext.getStatementContext().isWritesToTables() ?
state.getTableLevelRWLock().writeLock() : state.getTableLevelRWLock().readLock();
if (queryPlan == null) {
subqueryLookup = new SubordFullTableScanTableLookupStrategy(lock, state.getIterableTableScan());
} else {
EventTable[] indexes = new EventTable[queryPlan.getIndexDescs().length];
for (int i = 0; i < indexes.length; i++) {
indexes[i] = state.getIndexRepository().getIndexByDesc(queryPlan.getIndexDescs()[i].getIndexMultiKey());
}
subqueryLookup = queryPlan.getLookupStrategyFactory().makeStrategy(indexes, null);
subqueryLookup = new SubordIndexedTableLookupTableStrategy(subqueryLookup, lock);
}
}
return new SubSelectStrategyRealization(subqueryLookup, subselectAggregationPreprocessor, aggregationService, Collections.<ExprPriorNode, ExprPriorEvalStrategy>emptyMap(), Collections.<ExprPreviousNode, ExprPreviousEvalStrategy>emptyMap(), null, null);
}
示例11: getProcessorInstance
import com.espertech.esper.epl.named.NamedWindowProcessorInstance; //导入依赖的package包/类
public NamedWindowProcessorInstance getProcessorInstance() {
return processorInstance;
}
示例12: setNamedWindowProcessorInstance
import com.espertech.esper.epl.named.NamedWindowProcessorInstance; //导入依赖的package包/类
protected void setNamedWindowProcessorInstance(NamedWindowProcessorInstance namedWindowProcessorInstance) {
this.namedWindowProcessorInstance = namedWindowProcessorInstance;
}
示例13: getNamedWindowProcessorInstance
import com.espertech.esper.epl.named.NamedWindowProcessorInstance; //导入依赖的package包/类
public NamedWindowProcessorInstance getNamedWindowProcessorInstance() {
return namedWindowProcessorInstance;
}
示例14: FireAndForgetInstanceNamedWindow
import com.espertech.esper.epl.named.NamedWindowProcessorInstance; //导入依赖的package包/类
public FireAndForgetInstanceNamedWindow(NamedWindowProcessorInstance processorInstance) {
this.processorInstance = processorInstance;
}
示例15: process
import com.espertech.esper.epl.named.NamedWindowProcessorInstance; //导入依赖的package包/类
private EPPreparedQueryResult process(Collection<EventBean>[] snapshots) {
int numStreams = processors.length;
UniformPair<EventBean[]> results;
if (numStreams == 1)
{
if (statementSpec.getFilterRootNode() != null)
{
snapshots[0] = getFiltered(snapshots[0], Arrays.asList(statementSpec.getFilterRootNode()));
}
EventBean[] rows = snapshots[0].toArray(new EventBean[snapshots[0].size()]);
results = resultSetProcessor.processViewResult(rows, null, true);
}
else
{
Viewable[] viewablePerStream = new Viewable[numStreams];
for (int i = 0; i < numStreams; i++)
{
NamedWindowProcessorInstance instance = processors[i].getProcessorInstance(agentInstanceContext);
if (instance == null) {
throw new UnsupportedOperationException("Joins against named windows that are under context are not supported");
}
viewablePerStream[i] = instance.getTailViewInstance();
}
JoinSetComposerDesc joinSetComposerDesc = joinSetComposerPrototype.create(viewablePerStream, true);
JoinSetComposer joinComposer = joinSetComposerDesc.getJoinSetComposer();
JoinSetFilter joinFilter;
if (joinSetComposerDesc.getPostJoinFilterEvaluator() != null) {
joinFilter = new JoinSetFilter(joinSetComposerDesc.getPostJoinFilterEvaluator());
}
else {
joinFilter = null;
}
EventBean[][] oldDataPerStream = new EventBean[numStreams][];
EventBean[][] newDataPerStream = new EventBean[numStreams][];
for (int i = 0; i < numStreams; i++)
{
newDataPerStream[i] = snapshots[i].toArray(new EventBean[snapshots[i].size()]);
}
UniformPair<Set<MultiKey<EventBean>>> result = joinComposer.join(newDataPerStream, oldDataPerStream, agentInstanceContext);
if (joinFilter != null) {
joinFilter.process(result.getFirst(), null, agentInstanceContext);
}
results = resultSetProcessor.processJoinResult(result.getFirst(), null, true);
}
if (statementSpec.getSelectClauseSpec().isDistinct())
{
results.setFirst(EventBeanUtility.getDistinctByProp(results.getFirst(), eventBeanReader));
}
return new EPPreparedQueryResult(resultSetProcessor.getResultEventType(), results.getFirst());
}