com.espertech.esper.core.service
Class StatementResultServiceImpl

java.lang.Object
  extended by com.espertech.esper.core.service.StatementResultServiceImpl
All Implemented Interfaces:
StatementResultService

public class StatementResultServiceImpl
extends java.lang.Object
implements StatementResultService

Implements tracking of statement listeners and subscribers for a given statement such as to efficiently dispatch in situations where 0, 1 or more listeners are attached and/or 0 or 1 subscriber (such as iteration-only statement).


Field Summary
protected  java.lang.ThreadLocal<java.util.ArrayDeque<UniformPair<EventBean[]>>> lastResults
          Buffer for holding dispatchable events.
 
Constructor Summary
StatementResultServiceImpl(java.lang.String statementName, StatementLifecycleSvc statementLifecycleSvc, MetricReportingServiceSPI metricReportingService, ThreadingService threadingService)
          Ctor.
 
Method Summary
 void dispatchOnStop()
          Dispatches when the statement is stopped any remaining results.
 void execute()
          Execution of result indication.
 java.lang.String getStatementId()
           
 EPStatementListenerSet getStatementListenerSet()
           
 java.lang.String getStatementName()
           
 void indicate(UniformPair<EventBean[]> results)
          Stores for dispatching the statement results.
 boolean isMakeNatural()
          Returns true to indicate that natural events should be produced, for use in select expression processing.
 boolean isMakeSynthetic()
          Returns true to indicate that synthetic events should be produced, for use in select expression processing.
 void processDispatch(UniformPair<EventBean[]> events)
          Indicate an outbound result.
 void setContext(EPStatementSPI epStatement, EPServiceProviderSPI epServiceProvider, boolean isInsertInto, boolean isPattern, boolean isDistinct, boolean isForClause, StatementMetricHandle statementMetricHandle)
          For initialization of the service to provide statement context.
 void setSelectClause(java.lang.Class[] selectClauseTypes, java.lang.String[] selectClauseColumnNames, boolean forClauseDelivery, ExprEvaluator[] groupDeliveryExpressions, ExprEvaluatorContext exprEvaluatorContext)
          For initialize of the service providing select clause column types and names.
 void setUpdateListeners(EPStatementListenerSet updateListeners, boolean isRecovery)
          Indicate a change in update listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastResults

protected java.lang.ThreadLocal<java.util.ArrayDeque<UniformPair<EventBean[]>>> lastResults
Buffer for holding dispatchable events.

Constructor Detail

StatementResultServiceImpl

public StatementResultServiceImpl(java.lang.String statementName,
                                  StatementLifecycleSvc statementLifecycleSvc,
                                  MetricReportingServiceSPI metricReportingService,
                                  ThreadingService threadingService)
Ctor.

Parameters:
statementLifecycleSvc - handles persistence for statements
metricReportingService - for metrics reporting
threadingService - for outbound threading
Method Detail

setContext

public void setContext(EPStatementSPI epStatement,
                       EPServiceProviderSPI epServiceProvider,
                       boolean isInsertInto,
                       boolean isPattern,
                       boolean isDistinct,
                       boolean isForClause,
                       StatementMetricHandle statementMetricHandle)
Description copied from interface: StatementResultService
For initialization of the service to provide statement context.

Specified by:
setContext in interface StatementResultService
Parameters:
epStatement - the statement
epServiceProvider - the engine instance
isInsertInto - true if this is insert into
isPattern - true if this is a pattern statement
isDistinct - true if using distinct
statementMetricHandle - handle for metrics reporting

setSelectClause

public void setSelectClause(java.lang.Class[] selectClauseTypes,
                            java.lang.String[] selectClauseColumnNames,
                            boolean forClauseDelivery,
                            ExprEvaluator[] groupDeliveryExpressions,
                            ExprEvaluatorContext exprEvaluatorContext)
Description copied from interface: StatementResultService
For initialize of the service providing select clause column types and names.

Specified by:
setSelectClause in interface StatementResultService
Parameters:
selectClauseTypes - types of columns in the select clause
selectClauseColumnNames - column names

getStatementId

public java.lang.String getStatementId()
Specified by:
getStatementId in interface StatementResultService

isMakeSynthetic

public boolean isMakeSynthetic()
Description copied from interface: StatementResultService
Returns true to indicate that synthetic events should be produced, for use in select expression processing.

Specified by:
isMakeSynthetic in interface StatementResultService
Returns:
true to produce synthetic events

isMakeNatural

public boolean isMakeNatural()
Description copied from interface: StatementResultService
Returns true to indicate that natural events should be produced, for use in select expression processing.

Specified by:
isMakeNatural in interface StatementResultService
Returns:
true to produce natural (object[] column) events

getStatementName

public java.lang.String getStatementName()
Specified by:
getStatementName in interface StatementResultService

getStatementListenerSet

public EPStatementListenerSet getStatementListenerSet()
Specified by:
getStatementListenerSet in interface StatementResultService

setUpdateListeners

public void setUpdateListeners(EPStatementListenerSet updateListeners,
                               boolean isRecovery)
Description copied from interface: StatementResultService
Indicate a change in update listener.

Specified by:
setUpdateListeners in interface StatementResultService
Parameters:
updateListeners - is the new listeners and subscriber

indicate

public void indicate(UniformPair<EventBean[]> results)
Description copied from interface: StatementResultService
Stores for dispatching the statement results.

Specified by:
indicate in interface StatementResultService
Parameters:
results - is the insert and remove stream data

execute

public void execute()
Description copied from interface: StatementResultService
Execution of result indication.

Specified by:
execute in interface StatementResultService

processDispatch

public void processDispatch(UniformPair<EventBean[]> events)
Indicate an outbound result.

Parameters:
events - to indicate

dispatchOnStop

public void dispatchOnStop()
Dispatches when the statement is stopped any remaining results.

Specified by:
dispatchOnStop in interface StatementResultService

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com