/** * Returns the default runtime. The URI value for the runtime returned is "default". * * @param configuration is the configuration for the runtime * @return default instance of the runtime. * @throws ConfigurationException to indicate a configuration problem */ public static EPRuntime getDefaultRuntime(Configuration configuration) throws ConfigurationException { return getRuntime(EPRuntimeProvider.DEFAULT_RUNTIME_URI, configuration); }
/** * Returns a runtime for a given runtime URI. * <p> * Use the URI of "default" or null to return the default runtime. * * @param uri - the URI * @return runtime for the given URI. */ public static EPRuntime getRuntime(String uri) { return getRuntime(uri, new Configuration()); }
/** * Returns the runtime for the default URI. The URI value for the runtime returned is "default". * * @return default runtime */ public static EPRuntime getDefaultRuntime() { return getRuntime(EPRuntimeProvider.DEFAULT_RUNTIME_URI, new Configuration()); }
public void destroy() { if (main != null) { try { EPRuntimeProvider.getRuntime(runtimeURI).getDeploymentService().undeployAll(); } catch (EPUndeployException e) { log.warn("Failed to undeploy: " + e.getMessage(), e); } } log.info("OHLCSample-example stopped."); } }
public void destroy() { if (main != null) { try { EPRuntimeProvider.getRuntime(runtimeURI).getDeploymentService().undeployAll(); } catch (EPUndeployException e) { log.warn("Exception during undeploy: " + e.getMessage(), e); } } log.info("NamedWindowQuery-example stopped."); } }
public void destroy() { if (main != null) { try { EPRuntimeProvider.getRuntime(runtimeURI).getDeploymentService().undeployAll(); } catch (EPUndeployException e) { log.warn("Failed to undeploy: " + e.getMessage(), e); } } try { simulationThread.interrupt(); simulationThread.join(); } catch (InterruptedException e) { log.info("Interrupted", e); } main = null; log.info("StockTicker-example stopped."); } }
public void destroy() { if (main != null) { try { EPRuntimeProvider.getRuntime(runtimeURI).getDeploymentService().undeployAll(); } catch (EPUndeployException e) { log.warn("Failed to undeploy: " + e.getMessage(), e); } } try { simulationThread.interrupt(); simulationThread.join(); } catch (InterruptedException e) { log.info("Interrupted", e); } main = null; log.info("RFIDAssetZone-example stopped."); } }
public void destroy() { if (feedSimMain != null) { try { EPRuntimeProvider.getRuntime(runtimeURI).getDeploymentService().undeployAll(); } catch (EPUndeployException e) { log.warn("Failed to undeploy: " + e.getMessage(), e); } } try { simulationThread.interrupt(); simulationThread.join(); } catch (InterruptedException e) { log.info("Interrupted", e); } feedSimMain = null; log.info("MarketDataFeed-example stopped."); } }
public void destroy() { if (main != null) { try { EPRuntimeProvider.getRuntime(runtimeURI).getDeploymentService().undeployAll(); } catch (EPUndeployException e) { log.warn("Failed to undeploy: " + e.getMessage(), e); } } try { simulationThread.interrupt(); simulationThread.join(); } catch (InterruptedException e) { log.info("Interrupted", e); } main = null; log.info("Transaction-example stopped."); } }
public void destroy() throws EPUndeployException { EPRuntimeProvider.getRuntime(runtimeURI).getDeploymentService().undeployAll(); } }
public void destroy() { if (matchMakerMain != null) { try { EPRuntimeProvider.getRuntime(runtimeURI).getDeploymentService().undeployAll(); } catch (EPUndeployException e) { log.warn("Failed to undeploy: " + e.getMessage(), e); } } try { simulationThread.interrupt(); simulationThread.join(); } catch (InterruptedException e) { log.info("Interrupted", e); } matchMakerMain = null; log.info("MatchMaker-example stopped."); } }
public static void tryInvalidConfigurationRuntime(Configuration config, Consumer<Configuration> configurer, String expected) { config.getCommon().addEventType(SupportBean.class); configurer.accept(config); try { EPRuntimeProvider.getRuntime(UUID.randomUUID().toString(), config); fail(); } catch (ConfigurationException ex) { SupportMessageAssertUtil.assertMessage(ex, expected); } }
/** * Destroy the adapter. */ public synchronized void destroy() { if (log.isDebugEnabled()) { log.debug("Destroying Esper DB Adapter"); } EPRuntimeSPI runtime = (EPRuntimeSPI) EPRuntimeProvider.getRuntime(runtimeURI); for (String deployment : deployments) { try { runtime.getDeploymentService().undeploy(deployment); } catch (EPUndeployException e) { throw new EPException("Failed to undeploy: " + e.getMessage(), e); } } executorFactory.destroy(); } }
public void start() { if (log.isInfoEnabled()) { log.info("Starting EsperIO Kafka Output Adapter for runtime URI '{}'", runtimeURI); } // Obtain runtime EPRuntimeSPI runtime = (EPRuntimeSPI) EPRuntimeProvider.getRuntime(runtimeURI); // Obtain and invoke flow controlle String className = getRequiredProperty(properties, OUTPUT_FLOWCONTROLLER_CONFIG); EsperIOKafkaOutputFlowController controller; try { controller = (EsperIOKafkaOutputFlowController) JavaClassHelper.instantiate(EsperIOKafkaOutputFlowController.class, className, runtime.getServicesContext().getClasspathImportServiceRuntime().getClassForNameProvider()); EsperIOKafkaOutputFlowControllerContext context = new EsperIOKafkaOutputFlowControllerContext(runtime, properties); controller.initialize(context); } catch (Throwable t) { throw new ConfigurationException("Unexpected exception invoking flow-controller initialize method on class " + className + " for runtime URI '" + runtimeURI + "': " + t.getMessage(), t); } if (log.isInfoEnabled()) { log.info("Completed starting EsperIO Kafka Output Adapter for runtime URI '{}'", runtimeURI); } }
public LRMovingSimMain(int numberOfThreads, int numberOfAssetGroups, int numberOfSeconds, boolean isAssert, String runtimeURI, boolean continuousSimulation) { this.numberOfThreads = numberOfThreads; this.numberOfAssetGroups = numberOfAssetGroups; this.numberOfSeconds = numberOfSeconds; this.isAssert = isAssert; this.runtimeURI = runtimeURI; Configuration config = new Configuration(); config.getCommon().addEventType(LocationReport.class); config.getCommon().addEventType(AssetGroupingEvent.class); runtime = EPRuntimeProvider.getRuntime(runtimeURI, config); runtime.initialize(); }
public void run(Configuration config) { config.getRuntime().getThreading().setInternalTimerEnabled(true); config.getCommon().getTimeSource().setTimeUnit(TimeUnit.MICROSECONDS); try { EPRuntimeProvider.getRuntime(this.getClass().getSimpleName(), config).initialize(); fail(); } catch (ConfigurationException ex) { SupportMessageAssertUtil.assertMessage(ex, "Internal timer requires millisecond time resolution"); } config.getRuntime().getThreading().setInternalTimerEnabled(false); EPRuntime runtime = EPRuntimeProvider.getRuntime(this.getClass().getSimpleName(), config); try { runtime.getEventService().clockInternal(); fail(); } catch (EPException ex) { SupportMessageAssertUtil.assertMessage(ex, "Internal timer requires millisecond time resolution"); } runtime.destroy(); } }
public void run(Configuration configuration) { configuration.getRuntime().getExceptionHandling().getHandlerFactories().clear(); configuration.getCompiler().addPlugInAggregationFunctionForge("myinvalidagg", SupportInvalidAggregationFunctionForge.class.getName()); configuration.getCommon().addEventType(SupportBean.class); EPRuntime runtime = EPRuntimeProvider.getRuntime(ClientRuntimeExceptionHandlerNoHandler.class.getName(), configuration); String epl = "@Name('ABCName') select myinvalidagg() from SupportBean"; EPDeployment deployment; try { EPCompiled compiled = EPCompilerProvider.getCompiler().compile(epl, new CompilerArguments(configuration)); deployment = runtime.getDeploymentService().deploy(compiled); } catch (Throwable t) { throw new RuntimeException(t); } runtime.getEventService().sendEventBean(new SupportBean(), "SupportBean"); runtime.destroy(); } }
public void run(Configuration config) { SupportRuntimeStateListener listener = new SupportRuntimeStateListener(); EPRuntime runtime = EPRuntimeProvider.getRuntime(this.getClass().getSimpleName() + "__listenerstatechange", config); runtime.addRuntimeStateListener(listener); runtime.destroy(); assertSame(runtime, listener.assertOneGetAndResetDestroyedEvents()); runtime.initialize(); assertSame(runtime, listener.assertOneGetAndResetInitializedEvents()); runtime.removeAllRuntimeStateListeners(); runtime.initialize(); assertTrue(listener.getInitializedEvents().isEmpty()); runtime.addRuntimeStateListener(listener); SupportRuntimeStateListener listenerTwo = new SupportRuntimeStateListener(); runtime.addRuntimeStateListener(listenerTwo); runtime.initialize(); assertSame(runtime, listener.assertOneGetAndResetInitializedEvents()); assertSame(runtime, listenerTwo.assertOneGetAndResetInitializedEvents()); assertTrue(runtime.removeRuntimeStateListener(listener)); runtime.initialize(); assertSame(runtime, listenerTwo.assertOneGetAndResetInitializedEvents()); assertTrue(listener.getInitializedEvents().isEmpty()); runtime.destroy(); } }
public void run(Configuration configuration) { assertNoEngineJMX(); configuration.getCommon().addEventType(SupportBean.class); configuration.getRuntime().getMetricsReporting().setJmxRuntimeMetrics(true); EPRuntime runtime = EPRuntimeProvider.getRuntime(JMX_ENGINE_NAME, configuration); assertEngineJMX(); runtime.destroy(); assertNoEngineJMX(); }
public void run(Configuration configuration) { configuration.getRuntime().getThreading().setInternalTimerEnabled(false); configuration.getCommon().addEventType(SupportBean.class); EPRuntime runtime = EPRuntimeProvider.getRuntime(ClientRuntimeTimeControlClockType.class.getSimpleName(), configuration); runtime.getEventService().advanceTime(0); assertEquals(0, runtime.getEventService().getCurrentTime()); assertTrue(runtime.getEventService().isExternalClockingEnabled()); runtime.getEventService().clockInternal(); assertFalse(runtime.getEventService().isExternalClockingEnabled()); long waitStart = System.currentTimeMillis(); while (System.currentTimeMillis() - waitStart < 10000) { if (runtime.getEventService().getCurrentTime() > 0) { break; } } assertNotEquals(0, runtime.getEventService().getCurrentTime()); assertTrue(System.currentTimeMillis() > runtime.getEventService().getCurrentTime() - 10000); runtime.getEventService().clockExternal(); assertTrue(runtime.getEventService().isExternalClockingEnabled()); runtime.getEventService().advanceTime(0); threadSleep(500); assertEquals(0, runtime.getEventService().getCurrentTime()); runtime.destroy(); } }