Class EPRuntimeImpl
- All Implemented Interfaces:
EPRuntime
,EPRuntimeSPI
-
Constructor Summary
ConstructorDescriptionEPRuntimeImpl
(com.espertech.esper.common.client.configuration.Configuration configuration, String runtimeURI, Map<String, EPRuntimeSPI> runtimes, EPRuntimeOptions options) Constructor - initializes services. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a listener to runtime state changes that receives a before-destroy event.void
destroy()
Destroys the runtime.protected void
doInitialize
(Long startTime, EPRuntimeOptions options, Consumer<EPRuntimeSPIRunAfterDestroyCtx> runAfterDestroy) Performs the initialization.com.espertech.esper.common.client.configuration.Configuration
Returns a deep-copy of the configuration that is actively in use by the runtime.Returns the transient configuration, which are configuration values that are passed by reference (and not by value)Provides naming context for public named objects.com.espertech.esper.common.client.context.EPContextPartitionService
Returns the context partition service, for context partition informationcom.espertech.esper.common.client.dataflow.core.EPDataFlowService
Returns the data flow service, for managing dataflowsReturns the deployment service, for deploying and undeploying compiled modulesReturns the event service, for sending events to the runtime and for controlling timeReturns the event type service, for obtaining information on event typesReturns the fire-and-forget service, for executing fire-and-forget queriescom.espertech.esper.common.client.metric.EPMetricsService
Returns the metrics service, for managing runtime and statement metrics reportingcom.espertech.esper.common.client.render.EPRenderEventService
Returns the event rendering service, for rendering events to JSON and XMLReturns the runtime-instance global read-write lock.com.espertech.esper.common.client.EPCompilerPathable
Returns a path object for use by the compiler that represents a snapshot of the EPL objects deployed into the runtime at the time of this call.Returns the stage service, for managing stagesgetURI()
Returns the runtime URI, or "default" if this is the default runtime.com.espertech.esper.common.client.variable.EPVariableService
Returns the variable service, for reading and writing variablesvoid
Frees any resources associated with this runtime instance, and leaves the runtime instance ready for further use.void
initialize
(Long currentTime) void
initialize
(Consumer<EPRuntimeSPIRunAfterDestroyCtx> runAfterDestroy) boolean
Returns true if the runtime is in destroyed state, or false if not.void
Invoked after an initialize operation.void
Remove all listeners to runtime state changes.boolean
Removate a listener to runtime state changes.void
setConfiguration
(com.espertech.esper.common.client.configuration.Configuration configuration) Sets runtime configuration information for use in the next initialize.void
traverseStatements
(BiConsumer<EPDeployment, EPStatement> consumer)
-
Constructor Details
-
EPRuntimeImpl
public EPRuntimeImpl(com.espertech.esper.common.client.configuration.Configuration configuration, String runtimeURI, Map<String, EPRuntimeSPI> runtimes, EPRuntimeOptions options) throws com.espertech.esper.common.client.configuration.ConfigurationExceptionConstructor - initializes services.- Parameters:
configuration
- is the runtimeconfigurationruntimeURI
- is the runtime URI or "default" (or null which it assumes as "default") if this is the default providerruntimes
- map of URI and runtimeoptions
- runtime options or null when not provided- Throws:
com.espertech.esper.common.client.configuration.ConfigurationException
- is thrown to indicate a configuraton error
-
-
Method Details
-
postInitialize
public void postInitialize()Invoked after an initialize operation.- Specified by:
postInitialize
in interfaceEPRuntimeSPI
-
setConfiguration
public void setConfiguration(com.espertech.esper.common.client.configuration.Configuration configuration) Sets runtime configuration information for use in the next initialize.- Specified by:
setConfiguration
in interfaceEPRuntimeSPI
- Parameters:
configuration
- is the runtimeconfigs
-
getURI
Description copied from interface:EPRuntime
Returns the runtime URI, or "default" if this is the default runtime. -
getEventService
Description copied from interface:EPRuntime
Returns the event service, for sending events to the runtime and for controlling time- Specified by:
getEventService
in interfaceEPRuntime
- Returns:
- event service
-
getDeploymentService
Description copied from interface:EPRuntime
Returns the deployment service, for deploying and undeploying compiled modules- Specified by:
getDeploymentService
in interfaceEPRuntime
- Returns:
- deployment service
-
getStageService
Description copied from interface:EPRuntime
Returns the stage service, for managing stages- Specified by:
getStageService
in interfaceEPRuntime
- Returns:
- stage service
- Throws:
EPRuntimeDestroyedException
- thrown when the runtime has been destroyed
-
getServicesContext
- Specified by:
getServicesContext
in interfaceEPRuntimeSPI
-
getConfigurationDeepCopy
public com.espertech.esper.common.client.configuration.Configuration getConfigurationDeepCopy()Description copied from interface:EPRuntime
Returns a deep-copy of the configuration that is actively in use by the runtime.Note: This can be an expensive operation.
- Specified by:
getConfigurationDeepCopy
in interfaceEPRuntime
- Returns:
- deep copy of the configuration
-
getConfigurationTransient
Description copied from interface:EPRuntime
Returns the transient configuration, which are configuration values that are passed by reference (and not by value)- Specified by:
getConfigurationTransient
in interfaceEPRuntime
- Returns:
- transient configuration
-
destroy
public void destroy()Description copied from interface:EPRuntime
Destroys the runtime.Releases any resources held by the runtime. The runtime enteres a state in which operations provided by the runtime are not guaranteed to operate properly.
Removes the runtime URI from the known URIs. Allows configuration to change for the instance.
When destroying a runtime your application must make sure that threads that are sending events into the runtime have completed their work. More generally, the runtime should not be currently in use during or after the destroy operation.
-
isDestroyed
public boolean isDestroyed()Description copied from interface:EPRuntime
Returns true if the runtime is in destroyed state, or false if not.- Specified by:
isDestroyed
in interfaceEPRuntime
- Returns:
- indicator whether the runtime has been destroyed
-
initialize
public void initialize()Description copied from interface:EPRuntime
Frees any resources associated with this runtime instance, and leaves the runtime instance ready for further use.Do not use the
EPDeploymentService
administrative andEPEventService
runtime instances obtained before the initialize (including related services such as configuration, module management, etc.). Your application must obtain new administrative and runtime instances.Retains the existing configuration of the runtime instance but forgets any runtime configuration changes.
Stops and destroys any existing statement resources such as filters, patterns, expressions, views.
- Specified by:
initialize
in interfaceEPRuntime
-
initialize
- Specified by:
initialize
in interfaceEPRuntimeSPI
-
initialize
- Specified by:
initialize
in interfaceEPRuntimeSPI
-
doInitialize
protected void doInitialize(Long startTime, EPRuntimeOptions options, Consumer<EPRuntimeSPIRunAfterDestroyCtx> runAfterDestroy) Performs the initialization.- Parameters:
startTime
- optional start timeoptions
- runtime options or null when not providedrunAfterDestroy
- consumer to execute after destroy
-
getContext
Description copied from interface:EPRuntime
Provides naming context for public named objects.An extension point designed for use by input and output adapters as well as other extension services.
- Specified by:
getContext
in interfaceEPRuntime
- Returns:
- naming context providing name-to-object bindings
-
getRuntimeInstanceWideLock
Description copied from interface:EPRuntime
Returns the runtime-instance global read-write lock. The send-event methods takes a read lock. TheEPDeploymentService.deploy(EPCompiled)
andEPDeploymentService.undeploy(String)
methods take a write lock.- Specified by:
getRuntimeInstanceWideLock
in interfaceEPRuntime
- Returns:
- runtime instance global read-write lock
-
getServiceStatusProvider
- Specified by:
getServiceStatusProvider
in interfaceEPRuntimeSPI
-
addRuntimeStateListener
Description copied from interface:EPRuntime
Add a listener to runtime state changes that receives a before-destroy event. The listener collection applies set-semantics.- Specified by:
addRuntimeStateListener
in interfaceEPRuntime
- Parameters:
listener
- to add
-
removeRuntimeStateListener
Description copied from interface:EPRuntime
Removate a listener to runtime state changes.- Specified by:
removeRuntimeStateListener
in interfaceEPRuntime
- Parameters:
listener
- to remove- Returns:
- true to indicate the listener was removed, or fals
-
getEventServiceSPI
- Specified by:
getEventServiceSPI
in interfaceEPRuntimeSPI
-
removeAllRuntimeStateListeners
public void removeAllRuntimeStateListeners()Description copied from interface:EPRuntime
Remove all listeners to runtime state changes.- Specified by:
removeAllRuntimeStateListeners
in interfaceEPRuntime
-
getDataFlowService
public com.espertech.esper.common.client.dataflow.core.EPDataFlowService getDataFlowService()Description copied from interface:EPRuntime
Returns the data flow service, for managing dataflows- Specified by:
getDataFlowService
in interfaceEPRuntime
- Returns:
- data flow service
-
getContextPartitionService
public com.espertech.esper.common.client.context.EPContextPartitionService getContextPartitionService()Description copied from interface:EPRuntime
Returns the context partition service, for context partition information- Specified by:
getContextPartitionService
in interfaceEPRuntime
- Returns:
- context partition service
-
getVariableService
public com.espertech.esper.common.client.variable.EPVariableService getVariableService()Description copied from interface:EPRuntime
Returns the variable service, for reading and writing variables- Specified by:
getVariableService
in interfaceEPRuntime
- Returns:
- variable service
-
getMetricsService
public com.espertech.esper.common.client.metric.EPMetricsService getMetricsService()Description copied from interface:EPRuntime
Returns the metrics service, for managing runtime and statement metrics reporting- Specified by:
getMetricsService
in interfaceEPRuntime
- Returns:
- metrics service
-
getEventTypeService
Description copied from interface:EPRuntime
Returns the event type service, for obtaining information on event types- Specified by:
getEventTypeService
in interfaceEPRuntime
- Returns:
- event type service
-
getRenderEventService
public com.espertech.esper.common.client.render.EPRenderEventService getRenderEventService()Description copied from interface:EPRuntime
Returns the event rendering service, for rendering events to JSON and XML- Specified by:
getRenderEventService
in interfaceEPRuntime
- Returns:
- render event service
-
getFireAndForgetService
Description copied from interface:EPRuntime
Returns the fire-and-forget service, for executing fire-and-forget queries- Specified by:
getFireAndForgetService
in interfaceEPRuntime
- Returns:
- fire-and-forget service
-
getThreadingService
- Specified by:
getThreadingService
in interfaceEPRuntimeSPI
-
getRuntimePath
public com.espertech.esper.common.client.EPCompilerPathable getRuntimePath()Description copied from interface:EPRuntime
Returns a path object for use by the compiler that represents a snapshot of the EPL objects deployed into the runtime at the time of this call. The EPL objects deployed after a call to this method are not included.- Specified by:
getRuntimePath
in interfaceEPRuntime
- Returns:
- path
-
traverseStatements
- Specified by:
traverseStatements
in interfaceEPRuntimeSPI
-
getStatementSelectionSvc
- Specified by:
getStatementSelectionSvc
in interfaceEPRuntimeSPI
-
getReflectiveCompileSvc
- Specified by:
getReflectiveCompileSvc
in interfaceEPRuntimeSPI
-