StreamSpecCompiled streamSpec = statementSpec.getStreamSpecs().get(i);
if (streamSpec instanceof NamedWindowConsumerStreamSpec)
{
hasNamedWindow = true;
NamedWindowConsumerStreamSpec namedSpec = (NamedWindowConsumerStreamSpec) streamSpec;
NamedWindowProcessor processor = services.getNamedWindowService().getProcessor(namedSpec.getWindowName());
NamedWindowProcessorInstance processorInstance = processor.getProcessorInstance(agentInstanceContext);
if (processorInstance != null) {
final NamedWindowTailViewInstance consumerView = processorInstance.getTailViewInstance();
final NamedWindowConsumerView view = (NamedWindowConsumerView) viewableActivationResult[i].getViewable();
// preload view for stream unless the expiry policy is batch window
Iterator<EventBean> consumerViewIterator = consumerView.iterator();
boolean preload = !consumerView.getTailView().isParentBatchWindow() && consumerViewIterator.hasNext();
if (preload) {
if (isRecoveringResilient && numStreams < 2) {
preload = false;
}
}
if (preload) {
final boolean yesRecoveringResilient = isRecoveringResilient;
preloadList.add(new StatementAgentInstancePreload() {
public void executePreload() {
ArrayList<EventBean> eventsInWindow = new ArrayList<EventBean>();
for (EventBean aConsumerView : consumerView) {
eventsInWindow.add(aConsumerView);
}
EventBean[] newEvents = eventsInWindow.toArray(new EventBean[eventsInWindow.size()]);
view.update(newEvents, null);
if (!yesRecoveringResilient && joinPreloadMethod != null && !joinPreloadMethod.isPreloading() && agentInstanceContext.getEpStatementAgentInstanceHandle().getOptionalDispatchable() != null) {
agentInstanceContext.getEpStatementAgentInstanceHandle().getOptionalDispatchable().execute(agentInstanceContext);
}
}
});
}
}
else {
log.info("Named window access is out-of-context, the named window '" + namedSpec.getWindowName() + "' has been declared for a different context then the current statement, the aggregation and join state will not be initialized for statement expression [" + statementContext.getExpression() + "]");
}
preloadList.add(new StatementAgentInstancePreload() {
public void executePreload() {
// in a join, preload indexes, if any