public class EPRuntimeIsolatedImpl extends Object implements EPRuntimeIsolatedSPI, InternalEventRouteDest, EPRuntimeEventSender
Modifier and Type | Field and Description |
---|---|
protected boolean |
isLatchStatementInsertStream |
protected boolean |
isPrioritized |
protected boolean |
isSubselectPreeval |
protected ThreadLocal<ArrayBackedCollection<FilterHandle>> |
matchesArrayThreadLocal |
protected ThreadLocal<Map<EPStatementAgentInstanceHandle,ArrayDeque<FilterHandleCallback>>> |
matchesPerStmtThreadLocal |
protected ThreadLocal<ArrayBackedCollection<ScheduleHandle>> |
scheduleArrayThreadLocal |
protected ThreadLocal<Map<EPStatementAgentInstanceHandle,Object>> |
schedulePerStmtThreadLocal |
protected EPIsolationUnitServices |
services |
protected ThreadWorkQueue |
threadWorkQueue |
protected EPServicesContext |
unisolatedServices |
Constructor and Description |
---|
EPRuntimeIsolatedImpl(EPIsolationUnitServices svc,
EPServicesContext unisolatedSvc)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy for destroying an engine instance: sets references to null and clears thread-locals
|
void |
dispatch()
Dispatch events.
|
long |
getCurrentTime()
Returns current engine time.
|
String |
getEngineURI() |
EventSender |
getEventSender(String eventTypeName)
Returns a facility to process event objects that are of a known type.
|
EventSender |
getEventSender(URI[] uri)
For use with plug-in event representations, returns a facility to process event objects that are of one of a number of types
that one or more of the registered plug-in event representation extensions can reflect upon and provide an
event for.
|
Long |
getNextScheduledTime()
Returns the time at which the next schedule execution is expected, returns null if no schedule execution is
outstanding.
|
Map<String,Long> |
getStatementNearestSchedules() |
void |
processEvent(Object theEvent)
Process an unwrapped event.
|
protected void |
processMatches(EventBean theEvent) |
protected void |
processScheduleHandles(ArrayBackedCollection<ScheduleHandle> handles) |
void |
processStatementFilterMultiple(EPStatementAgentInstanceHandle handle,
ArrayDeque<FilterHandleCallback> callbackList,
EventBean theEvent)
Processing multiple filter matches for a statement.
|
void |
processStatementFilterSingle(EPStatementAgentInstanceHandle handle,
EPStatementHandleCallback handleCallback,
EventBean theEvent)
Process a single match.
|
void |
processThreadWorkQueue()
Works off the thread's work queue.
|
void |
processWrappedEvent(EventBean eventBean)
Process a wrapped event.
|
void |
route(EventBean theEvent,
EPStatementHandle epStatementHandle,
boolean addToFront)
Route the event such that the event is processed as required.
|
void |
route(Node document)
Route a XML docment event
|
void |
routeEventBean(EventBean theEvent)
For processing a routed event.
|
void |
sendEvent(Map map,
String eventTypeName)
Send a map containing event property values to the event stream processing runtime.
|
void |
sendEvent(Node document)
Send an event represented by a DOM node to the event stream processing runtime.
|
void |
sendEvent(Object theEvent)
Send an event represented by a plain Java object to the event stream processing runtime.
|
void |
sendEvent(Object[] objectarray,
String objectArrayEventTypeName)
Send an object array containing event property values to the event stream processing runtime.
|
void |
setInternalEventRouter(InternalEventRouter internalEventRouter) |
protected EPServicesContext unisolatedServices
protected EPIsolationUnitServices services
protected boolean isSubselectPreeval
protected boolean isPrioritized
protected boolean isLatchStatementInsertStream
protected ThreadWorkQueue threadWorkQueue
protected ThreadLocal<Map<EPStatementAgentInstanceHandle,ArrayDeque<FilterHandleCallback>>> matchesPerStmtThreadLocal
protected ThreadLocal<Map<EPStatementAgentInstanceHandle,Object>> schedulePerStmtThreadLocal
protected ThreadLocal<ArrayBackedCollection<FilterHandle>> matchesArrayThreadLocal
protected ThreadLocal<ArrayBackedCollection<ScheduleHandle>> scheduleArrayThreadLocal
public EPRuntimeIsolatedImpl(EPIsolationUnitServices svc, EPServicesContext unisolatedSvc)
svc
- isolated servicesunisolatedSvc
- engine servicespublic void sendEvent(Object theEvent) throws EPException
EPRuntimeIsolated
Use the route method for sending events into the runtime from within UpdateListener code, to avoid the possibility of a stack overflow due to nested calls to sendEvent.
sendEvent
in interface EPRuntimeIsolated
theEvent
- is the event to sent to the runtimeEPException
- is thrown when the processing of the event lead to an errorpublic void sendEvent(Node document) throws EPException
EPRuntimeIsolated
Use the route method for sending events into the runtime from within UpdateListener code. to avoid the possibility of a stack overflow due to nested calls to sendEvent.
sendEvent
in interface EPRuntimeIsolated
document
- is the DOM node as an eventEPException
- is thrown when the processing of the event lead to an errorpublic void route(Node document) throws EPException
document
- to routeEPException
- if routing failedpublic void sendEvent(Map map, String eventTypeName) throws EPException
EPRuntimeIsolated
Use the route method for sending events into the runtime from within UpdateListener code. to avoid the possibility of a stack overflow due to nested calls to sendEvent.
sendEvent
in interface EPRuntimeIsolated
map
- - map that contains event property values. Keys are expected to be of type String while values
can be of any type. Keys and values should match those declared via Configuration for the given eventTypeName.eventTypeName
- - the name for the Map event type that was previously configuredEPException
- - when the processing of the event leads to an errorpublic void sendEvent(Object[] objectarray, String objectArrayEventTypeName)
EPRuntimeIsolated
Use the route method for sending events into the runtime from within UpdateListener code. to avoid the possibility of a stack overflow due to nested calls to sendEvent.
sendEvent
in interface EPRuntimeIsolated
objectarray
- - array that contains event property values. Your application must ensure that property values
match the exact same order that the property names and types have been declared, and that the array length matches the number of properties declared.objectArrayEventTypeName
- - the name for the Object-array event type that was previously configuredpublic void processEvent(Object theEvent)
theEvent
- to process.public void processWrappedEvent(EventBean eventBean)
processWrappedEvent
in interface EPRuntimeEventSender
eventBean
- to processprotected void processScheduleHandles(ArrayBackedCollection<ScheduleHandle> handles)
public void processThreadWorkQueue()
processThreadWorkQueue
in interface InternalEventRouteDest
protected void processMatches(EventBean theEvent)
public void processStatementFilterMultiple(EPStatementAgentInstanceHandle handle, ArrayDeque<FilterHandleCallback> callbackList, EventBean theEvent)
handle
- statement handlecallbackList
- object containing callbackstheEvent
- to processpublic void processStatementFilterSingle(EPStatementAgentInstanceHandle handle, EPStatementHandleCallback handleCallback, EventBean theEvent)
handle
- statementhandleCallback
- callbacktheEvent
- event to indicatepublic void dispatch()
dispatch
in interface InternalEventRouteDest
public void destroy()
public long getCurrentTime()
EPRuntimeIsolated
If time is provided externally via timer events, the function returns current time as externally provided.
getCurrentTime
in interface EPRuntimeIsolated
public void route(EventBean theEvent, EPStatementHandle epStatementHandle, boolean addToFront)
InternalEventRouteDest
route
in interface InternalEventRouteDest
theEvent
- to routeepStatementHandle
- provides statement resourcesaddToFront
- whether to add to the front of the work queuepublic void setInternalEventRouter(InternalEventRouter internalEventRouter)
setInternalEventRouter
in interface InternalEventRouteDest
public Long getNextScheduledTime()
EPRuntimeIsolated
getNextScheduledTime
in interface EPRuntimeIsolated
public Map<String,Long> getStatementNearestSchedules()
getStatementNearestSchedules
in interface EPRuntimeIsolatedSPI
public String getEngineURI()
getEngineURI
in interface InternalEventRouteDest
public EventSender getEventSender(String eventTypeName)
EPRuntimeIsolated
Given an event type name this method returns a sender that allows to send in event objects of that type. The event objects send in via the event sender are expected to match the event type, thus the event sender does not inspect the event object other then perform basic checking.
For events backed by a Java class (JavaBean events), the sender ensures that the object send in matches in class, or implements or extends the class underlying the event type for the given event type name.
For events backed by a Object[] (Object-array events), the sender does not perform any checking other then checking that the event object indeed is an array of object.
For events backed by a java.util.Map (Map events), the sender does not perform any checking other then checking that the event object indeed implements Map.
For events backed by a org.w3c.Node (XML DOM events), the sender checks that the root element name indeed does match the root element name for the event type name.
getEventSender
in interface EPRuntimeIsolated
eventTypeName
- is the name of the event typepublic EventSender getEventSender(URI[] uri) throws EventTypeException
EPRuntimeIsolated
getEventSender
in interface EPRuntimeIsolated
uri
- is the URIs that specify which plug-in event representations may process an event object.
URIs do not need to match event representation URIs exactly, a child (hierarchical) match is enough for an event representation to participate.
The order of URIs is relevant as each event representation's factory is asked in turn to process the event, until the first factory processes the event.
EventTypeException
- thrown to indicate that the URI list was invalidpublic void routeEventBean(EventBean theEvent)
EPRuntimeEventSender
routeEventBean
in interface EPRuntimeEventSender
theEvent
- routed event