|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.esper.core.EPStatementImpl
public class EPStatementImpl
Statement implementation for EQL statements.
Constructor Summary | |
---|---|
EPStatementImpl(EPServiceProvider epServiceProvider,
String statementId,
String statementName,
String expressionText,
boolean isPattern,
DispatchService dispatchService,
StatementLifecycleSvc statementLifecycleSvc,
long timeLastStateChange,
boolean isBlockingDispatch,
boolean isSpinBlockingDispatch,
long msecBlockingTimeout,
EPStatementHandle epStatementHandle,
VariableService variableService)
Ctor. |
Method Summary | |
---|---|
void |
addListener(StatementAwareUpdateListener listener)
Add a statement-aware listener that observes events. |
void |
addListener(UpdateListener listener)
Add a listener to the statement. |
void |
destroy()
Destroy the statement releasing all statement resources. |
EventType |
getEventType()
Returns the type of events the iterable returns. |
EPStatementListenerSet |
getListenerSet()
Returns the set of listeners to the statement. |
String |
getName()
Returns the statement name. |
EPStatementState |
getState()
Returns the statement's current state. |
Iterator<StatementAwareUpdateListener> |
getStatementAwareListeners()
Returns an iterator of statement-aware update listeners. |
String |
getStatementId()
Returns the statement id. |
String |
getText()
Returns the underlying expression text. |
long |
getTimeLastStateChange()
Returns the system time in milliseconds of when the statement last change state. |
Iterator<UpdateListener> |
getUpdateListeners()
Returns an iterator of update listeners. |
boolean |
isDestroyed()
Returns true if the statement state is destroyed. |
boolean |
isStarted()
Returns true if the statement state is started. |
boolean |
isStopped()
Returns true if the statement state is stopped. |
Iterator<EventBean> |
iterator()
Returns a concurrency-unsafe iterator over events representing statement results (pull API). |
void |
removeAllListeners()
Remove all listeners to a statement. |
void |
removeListener(StatementAwareUpdateListener listener)
Remove a statement-aware listener that observes events. |
void |
removeListener(UpdateListener listener)
Remove a listeners to a statement. |
SafeIterator<EventBean> |
safeIterator()
Returns a concurrency-safe iterator that iterates over events representing statement results (pull API) in the face of concurrent event processing by further threads. |
void |
setCurrentState(EPStatementState currentState,
long timeLastStateChange)
Set statement state. |
void |
setListeners(EPStatementListenerSet listenerSet)
Sets the statement listeners. |
void |
setParentView(Viewable viewable)
Sets the parent view. |
void |
start()
Start the statement. |
void |
stop()
Stop the statement. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EPStatementImpl(EPServiceProvider epServiceProvider, String statementId, String statementName, String expressionText, boolean isPattern, DispatchService dispatchService, StatementLifecycleSvc statementLifecycleSvc, long timeLastStateChange, boolean isBlockingDispatch, boolean isSpinBlockingDispatch, long msecBlockingTimeout, EPStatementHandle epStatementHandle, VariableService variableService)
statementId
- is a unique ID assigned by the engine for the statementstatementName
- is the statement name assigned during creation, or the statement id if none was assignedexpressionText
- is the EQL and/or pattern expressionisPattern
- is true to indicate this is a pure pattern expressiondispatchService
- for dispatching events to listeners to the statementstatementLifecycleSvc
- handles lifecycle transitions for the statementisBlockingDispatch
- is true if the dispatch to listeners should block to preserve event generation orderisSpinBlockingDispatch
- true to use spin locks blocking to deliver results, as locks are usually uncontendedmsecBlockingTimeout
- is the max number of milliseconds of block timeepServiceProvider
- is the engine instance to provide to statement-aware update listenerstimeLastStateChange
- the timestamp the statement was created and startedepStatementHandle
- the handle and statement lock associated with the statementvariableService
- provides access to variable valuesMethod Detail |
---|
public String getStatementId()
EPStatementSPI
getStatementId
in interface EPStatementSPI
public void start()
EPStatement
start
in interface EPStatement
public void stop()
EPStatement
stop
in interface EPStatement
public void destroy()
EPStatement
A destroyed statement cannot be started again.
destroy
in interface EPStatement
public EPStatementState getState()
EPStatement
getState
in interface EPStatement
public void setCurrentState(EPStatementState currentState, long timeLastStateChange)
EPStatementSPI
setCurrentState
in interface EPStatementSPI
currentState
- new current statetimeLastStateChange
- the timestamp the statement changed statepublic void setParentView(Viewable viewable)
EPStatementSPI
setParentView
in interface EPStatementSPI
viewable
- is the statement viewablepublic String getText()
EPStatement
getText
in interface EPStatement
public String getName()
EPStatement
getName
in interface EPStatement
public Iterator<EventBean> iterator()
EPIterable
The iterator is useful for applications that are single-threaded, or that coordinate the iterating thread with event processing threads that use the sendEvent method using application code locks or synchronization.
The iterator returned by this method does not make any guarantees towards correctness of results and fail-behavior, if your application processes events into the engine instance using the sendEvent method by multiple threads.
Use the safeIterator method for concurrency-safe iteration. Note the safe iterator requires applications to explicitly close the safe iterator when done iterating.
iterator
in interface EPIterable
public SafeIterator<EventBean> safeIterator()
EPIterable
In comparison to the regular iterator, the safe iterator guarantees correct results even as events are being processed by other threads. The cost is that the iterator holds one or more locks that must be released via the close method. Any locks are acquired at the time this method is called.
This method is a blocking method. It may block until statement processing locks are released such that the safe iterator can acquire any required locks.
An application MUST explicitly close the safe iterator instance using the close method, to release locks held by the iterator. The call to the close method should be done in a finally block to make sure the iterator gets closed.
Multiple safe iterators may be not be used at the same time by different application threads. A single application thread may hold and use multiple safe iterators however this is discouraged.
safeIterator
in interface EPIterable
public EventType getEventType()
EPIterable
getEventType
in interface EPIterable
public EPStatementListenerSet getListenerSet()
getListenerSet
in interface EPStatementSPI
public void setListeners(EPStatementListenerSet listenerSet)
EPStatementSPI
Care must be taken in the use of this method as unsynchronized modification to the listeners of a statement can yield problems.
setListeners
in interface EPStatementSPI
listenerSet
- setpublic void addListener(UpdateListener listener)
addListener
in interface EPListenable
listener
- to addpublic void removeListener(UpdateListener listener)
removeListener
in interface EPListenable
listener
- to removepublic void removeAllListeners()
removeAllListeners
in interface EPListenable
public void addListener(StatementAwareUpdateListener listener)
EPListenable
addListener
in interface EPListenable
listener
- to addpublic void removeListener(StatementAwareUpdateListener listener)
EPListenable
removeListener
in interface EPListenable
listener
- to removepublic Iterator<StatementAwareUpdateListener> getStatementAwareListeners()
EPListenable
The returned iterator does not allow the remove operation.
getStatementAwareListeners
in interface EPListenable
public Iterator<UpdateListener> getUpdateListeners()
EPListenable
The returned iterator does not allow the remove operation.
getUpdateListeners
in interface EPListenable
public long getTimeLastStateChange()
EPStatement
getTimeLastStateChange
in interface EPStatement
public boolean isStarted()
EPStatement
isStarted
in interface EPStatement
public boolean isStopped()
EPStatement
isStopped
in interface EPStatement
public boolean isDestroyed()
EPStatement
isDestroyed
in interface EPStatement
|
© 2007 EsperTech Inc. All rights reserved. Visit us at espertech.com |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |