com.espertech.esper.core
Class StatementResultServiceImpl

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

public class StatementResultServiceImpl
extends 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  ThreadLocal<ArrayDequeJDK6Backport<UniformPair<EventBean[]>>> lastResults
          Buffer for holding dispatchable events.
 
Constructor Summary
StatementResultServiceImpl(StatementLifecycleSvc statementLifecycleSvc)
          Ctor.
 
Method Summary
 void dispatchOnStop()
          Dispatches when the statement is stopped any remaining results.
 void execute()
          Execution of result indication.
 EventBean getLastIterableEvent()
          Returns the last iterable event, for use by patterns since these are not iterable.
 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 setContext(EPStatementSPI epStatement, EPServiceProvider epServiceProvider, boolean isInsertInto, boolean isPattern)
          For initialization of the service to provide statement context.
 void setSelectClause(Class[] selectClauseTypes, String[] selectClauseColumnNames)
          For initialize of the service providing select clause column types and names.
 void setUpdateListeners(EPStatementListenerSet statementListenerSet)
          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 ThreadLocal<ArrayDequeJDK6Backport<UniformPair<EventBean[]>>> lastResults
Buffer for holding dispatchable events.

Constructor Detail

StatementResultServiceImpl

public StatementResultServiceImpl(StatementLifecycleSvc statementLifecycleSvc)
Ctor.

Parameters:
statementLifecycleSvc - handles persistence for statements
Method Detail

setContext

public void setContext(EPStatementSPI epStatement,
                       EPServiceProvider epServiceProvider,
                       boolean isInsertInto,
                       boolean isPattern)
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

setSelectClause

public void setSelectClause(Class[] selectClauseTypes,
                            String[] selectClauseColumnNames)
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

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

getLastIterableEvent

public EventBean getLastIterableEvent()
Description copied from interface: StatementResultService
Returns the last iterable event, for use by patterns since these are not iterable.

Specified by:
getLastIterableEvent in interface StatementResultService
Returns:
last event

setUpdateListeners

public void setUpdateListeners(EPStatementListenerSet statementListenerSet)
Description copied from interface: StatementResultService
Indicate a change in update listener.

Specified by:
setUpdateListeners in interface StatementResultService
Parameters:
statementListenerSet - 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

dispatchOnStop

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

Specified by:
dispatchOnStop in interface StatementResultService

© 2007 EsperTech Inc.
All rights reserved.
Visit us at espertech.com