{
log.debug(".createStream filter already found");
eventStreamsRefCounted.reference(filterSpec);
// audit proxy
EventStream eventStream = EventStreamProxy.getAuditProxy(engineURI, epStatementAgentInstanceHandle.getStatementHandle().getStatementName(), annotations, filterSpec, pair.getFirst());
// We return the lock of the statement first establishing the stream to use that as the new statement's lock
return new Pair<EventStream, StatementAgentInstanceLock>(eventStream, pair.getSecond().getAgentInstanceHandle().getStatementAgentInstanceLock());
}
}
// New event stream
EventType resultEventType = filterSpec.getResultEventType();
EventStream zeroDepthStream = new ZeroDepthStream(resultEventType);
// audit proxy
EventStream inputStream = EventStreamProxy.getAuditProxy(engineURI, epStatementAgentInstanceHandle.getStatementHandle().getStatementName(), annotations, filterSpec, zeroDepthStream);
final EventStream eventStream = inputStream;
FilterHandleCallback filterCallback;
if (filterSpec.getOptionalPropertyEvaluator() != null)
{
filterCallback = new FilterHandleCallback()
{
public String getStatementId()
{
return statementId;
}
public void matchFound(EventBean theEvent, Collection<FilterHandleCallback> allStmtMatches)
{
EventBean[] result = filterSpec.getOptionalPropertyEvaluator().getProperty(theEvent, exprEvaluatorContext);
if (result == null)
{
return;
}
eventStream.insert(result);
}
public boolean isSubSelect()
{
return false;
}
};
}
else
{
filterCallback = new FilterHandleCallback()
{
public String getStatementId()
{
return statementId;
}
public void matchFound(EventBean theEvent, Collection<FilterHandleCallback> allStmtMatches)
{
InstrumentationHelper.get().qFilterActivationStream(theEvent.getEventType().getName(), streamNum);
eventStream.insert(theEvent);
InstrumentationHelper.get().aFilterActivationStream();
}
public boolean isSubSelect()
{
return false;