/** * 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); }
public void destroy() { if (main != null) { try { EPRuntimeProvider.getDefaultRuntime().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("QualityOfService-example stopped."); } }
EPRuntimeSPI runtime = (EPRuntimeSPI) EPRuntimeProvider.getExistingRuntime(runtimeURI);
public void run(Configuration config) { String uriOne = this.getClass().getName() + "_1"; EPRuntime runtimeOne = EPRuntimeProvider.getRuntime(uriOne, config); String uriTwo = this.getClass().getName() + "_2"; EPRuntime runtimeTwo = EPRuntimeProvider.getRuntime(uriTwo, config); EPAssertionUtil.assertContains(EPRuntimeProvider.getRuntimeURIs(), uriOne, uriTwo); assertNotNull(EPRuntimeProvider.getExistingRuntime(uriOne)); assertNotNull(EPRuntimeProvider.getExistingRuntime(uriTwo)); EPAssertionUtil.assertNotContains(EPRuntimeProvider.getRuntimeURIs(), uriOne); EPAssertionUtil.assertContains(EPRuntimeProvider.getRuntimeURIs(), uriTwo); assertNull(EPRuntimeProvider.getExistingRuntime(uriOne)); assertTrue(runtimeOne.isDestroyed()); assertFalse(runtimeTwo.isDestroyed()); EPAssertionUtil.assertNotContains(EPRuntimeProvider.getRuntimeURIs(), uriOne, uriTwo); assertNull(EPRuntimeProvider.getExistingRuntime(uriTwo)); assertTrue(runtimeOne.isDestroyed()); assertTrue(runtimeTwo.isDestroyed()); EPAssertionUtil.assertNotContains(EPRuntimeProvider.getRuntimeURIs(), uriTwo);
/** * Returns a runtime for a given URI. * Use the URI of "default" or null to return the default runtime. * * @param uri - the runtime URI. If null provided it assumes "default". * @param configuration is the configuration for the runtime * @return Runtime for the given URI. * @throws ConfigurationException to indicate a configuration problem */ public static EPRuntime getRuntime(String uri, Configuration configuration) throws ConfigurationException { String runtimeURINonNull = (uri == null) ? EPRuntimeProvider.DEFAULT_RUNTIME_URI : uri; if (runtimes.containsKey(runtimeURINonNull)) { EPRuntimeSPI runtime = runtimes.get(runtimeURINonNull); if (runtime.isDestroyed()) { runtime = getRuntimeInternal(configuration, runtimeURINonNull); runtimes.put(runtimeURINonNull, runtime); } else { runtime.setConfiguration(configuration); } return runtime; } // New runtime EPRuntimeSPI runtime = getRuntimeInternal(configuration, runtimeURINonNull); runtimes.put(runtimeURINonNull, runtime); runtime.postInitialize(); return runtime; }
/** * 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()); }
Configuration configuration = new Configuration(); configuration.getCommon().addEventType("SampleEvent", SampleEvent.class.getName()); EPRuntime runtime = EPRuntimeProvider.getDefaultRuntime(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()); }
public void runExample() { // Allocate default provider in default configuration runtime = EPRuntimeProvider.getDefaultRuntime(); // Add an event type compileDeploy("create schema MyEvent(propertyOne string, propertyTwo int)"); // Configure and test variables configureVariables(); // Configure and test a variant stream configureVariantStream(); // Configure and test an import configureImport(); // Add a single-row function configureSingleRowFunction(); // Add a custom aggregation function configureCustomAggregationFunction(); }
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."); } }
config.getCompiler().getByteCode().setAccessModifiersPublic(); EPRuntime runtime = EPRuntimeProvider.getDefaultRuntime(config); runtime.initialize();
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 RFIDMouseDragExample() { super(); // Setup runtime Configuration config = new Configuration(); config.getCommon().addEventType("LocationReport", LocationReport.class); EPRuntime runtime = EPRuntimeProvider.getDefaultRuntime(config); LRMovingZoneStmt.createStmt(runtime, 10, new UpdateListener() { public void update(EventBean[] newEvents, EventBean[] oldEvents, EPStatement statement, EPRuntime runtime) { for (int i = 0; i < newEvents.length; i++) { System.out.println("ALERT: Asset group not moving together, zone " + newEvents[i].get("Part.zone")); } } }); // Setup window Container container = getContentPane(); canvas = new DisplayCanvas(runtime, WIDTH, HEIGHT); container.add(canvas); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); setSize(WIDTH, HEIGHT); setVisible(true); }
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 CycleDetectMain() { Configuration configuration = new Configuration(); configuration.getCommon().addEventType(TransactionEvent.class); String[] functionNames = new String[]{CycleDetectorConstant.CYCLEDETECTED_NAME, CycleDetectorConstant.CYCLEOUTPUT_NAME}; ConfigurationCompilerPlugInAggregationMultiFunction config = new ConfigurationCompilerPlugInAggregationMultiFunction(functionNames, CycleDetectorAggregationForge.class.getName()); configuration.getCompiler().addPlugInAggregationMultiFunction(config); try { String eplCycleDetectEachEvent = "@Name('CycleDetector') " + "select cycleoutput() as out " + "from TransactionEvent#length(1000) " + "having cycledetected(fromAcct, toAcct)"; EPCompiled compiled = EPCompilerProvider.getCompiler().compile(eplCycleDetectEachEvent, new CompilerArguments(configuration)); runtime = EPRuntimeProvider.getDefaultRuntime(configuration); DeploymentOptions deploymentOptions = new DeploymentOptions().setDeploymentId("CycleDetect"); EPStatement stmt = runtime.getDeploymentService().deploy(compiled, deploymentOptions).getStatements()[0]; stmt.addListener(new UpdateListener() { public void update(EventBean[] newEvents, EventBean[] oldEvents, EPStatement statement, EPRuntime runtime) { for (EventBean event : newEvents) { @SuppressWarnings("unchecked") Collection<String> accts = (Collection<String>) event.get("out"); System.out.println("Cycle detected: " + accts); } } }); } catch (Exception ex) { throw new RuntimeException("Failed to deploy: " + ex.getMessage(), ex); } }
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."); } }
runtime = EPRuntimeProvider.getDefaultRuntime(config);
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() { 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() throws EPUndeployException { EPRuntimeProvider.getRuntime(runtimeURI).getDeploymentService().undeployAll(); } }