public class StreamFactorySvcImpl extends Object implements StreamFactoryService
For non-join statements, the class manages the reuse of event streams when filters match, and thus when an event stream is reused such can be the views under the stream. For joins however, this can lead to problems in multithread-safety since the statement resource lock would then have to be multiple locks, i.e. the reused statement's resource lock and the join statement's own lock, at a minimum.
For join statements, always creating a new event stream and therefore not reusing view resources, for use with joins.
This can be very effective in that if a client applications creates a large number of very similar statements in terms of filters and views used then these resources are all re-used across statements.
The re-use is multithread-safe in that (A) statement start/stop is locked against other engine processing (B) the first statement supplies the lock for shared filters and views, protecting multiple threads from entering into the same view. (C) joins statements do not participate in filter and view reuse
Constructor and Description |
---|
StreamFactorySvcImpl(String engineURI,
boolean isReuseViews)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
Pair<EventStream,StatementAgentInstanceLock> |
createStream(int statementId,
FilterSpecCompiled filterSpec,
FilterService filterService,
EPStatementAgentInstanceHandle epStatementAgentInstanceHandle,
boolean isJoin,
AgentInstanceContext agentInstanceContext,
boolean hasOrderBy,
boolean filterWithSameTypeSubselect,
Annotation[] annotations,
boolean stateless,
int streamNum,
boolean isCanIterateUnbound)
See the method of the same name in
StreamFactoryService . |
void |
destroy()
Destroy the service.
|
void |
dropStream(FilterSpecCompiled filterSpec,
FilterService filterService,
boolean isJoin,
boolean hasOrderBy,
boolean filterWithSameTypeSubselect,
boolean stateless)
See the method of the same name in
StreamFactoryService . |
public StreamFactorySvcImpl(String engineURI, boolean isReuseViews)
isReuseViews
- indicator on whether stream and view resources are to be reused between statementsengineURI
- engine URIpublic void destroy()
StreamFactoryService
destroy
in interface StreamFactoryService
public Pair<EventStream,StatementAgentInstanceLock> createStream(int statementId, FilterSpecCompiled filterSpec, FilterService filterService, EPStatementAgentInstanceHandle epStatementAgentInstanceHandle, boolean isJoin, AgentInstanceContext agentInstanceContext, boolean hasOrderBy, boolean filterWithSameTypeSubselect, Annotation[] annotations, boolean stateless, int streamNum, boolean isCanIterateUnbound)
StreamFactoryService
. Always attempts to reuse an existing event stream.
May thus return a new event stream or an existing event stream depending on whether filter criteria match.createStream
in interface StreamFactoryService
filterSpec
- is the filter definitionepStatementAgentInstanceHandle
- is the statement resource lockstatementId
- the statement idfilterService
- filter service to activate filter if not already activeisJoin
- is indicatng whether the stream will participate in a join statement, information
necessary for stream reuse and multithreading concernsagentInstanceContext
- expression evaluation contexthasOrderBy
- if the consumer has order-byfilterWithSameTypeSubselect
- whether filter and subselect type matchannotations
- annotationsstateless
- whether statelessstreamNum
- stream numberisCanIterateUnbound
- whether we can iterate unboundpublic void dropStream(FilterSpecCompiled filterSpec, FilterService filterService, boolean isJoin, boolean hasOrderBy, boolean filterWithSameTypeSubselect, boolean stateless)
StreamFactoryService
.dropStream
in interface StreamFactoryService
filterSpec
- is the filter definitionfilterService
- to be used to deactivate filter when the last event stream is droppedisJoin
- is indicatng whether the stream will participate in a join statement, information
necessary for stream reuse and multithreading concernshasOrderBy
- if the consumer has an order-by clausefilterWithSameTypeSubselect
- whether filter and subselect event type matchstateless
- whether stateless