public String getRuntimeURI() { return servicesContext.getRuntimeURI(); }
public String getRuntimeURI() { return services.getRuntimeURI(); }
public void run() { try { runtime.processWrappedEvent(eventBean); } catch (RuntimeException e) { services.getExceptionHandlingService().handleInboundPoolException(services.getRuntimeURI(), e, eventBean); log.error("Unexpected error processing wrapped event: " + e.getMessage(), e); } } }
private synchronized void startEngineMetrics(EPServicesContext services, EPEventService runtime) { MetricName filterName = MetricNameFactory.name(services.getRuntimeURI(), "filter"); CommonJMXUtil.registerMbean(services.getFilterService(), filterName); MetricName scheduleName = MetricNameFactory.name(services.getRuntimeURI(), "schedule"); CommonJMXUtil.registerMbean(services.getSchedulingService(), scheduleName); MetricName runtimeName = MetricNameFactory.name(services.getRuntimeURI(), "runtime"); CommonJMXUtil.registerMbean(runtime, runtimeName); }
private void processThreadWorkQueueUnlatched(Object item) { EventBean eventBean; if (item instanceof EventBean) { eventBean = (EventBean) item; } else { throw new IllegalStateException("Unexpected item type " + item + " in queue"); } if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().qEvent(eventBean, services.getRuntimeURI(), false); } services.getEventProcessingRWLock().acquireReadLock(); try { processMatches(eventBean); } catch (RuntimeException ex) { matchesArrayThreadLocal.get().clear(); throw ex; } finally { services.getEventProcessingRWLock().releaseReadLock(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().aEvent(); } } dispatch(); }
public void initThreading(EPServicesContext services, EPEventServiceImpl runtime) { this.servicesContext = services; if (isInboundThreading) { inboundQueue = makeQueue(config.getThreadPoolInboundCapacity()); inboundThreadPool = getThreadPool(services.getRuntimeURI(), "Inbound", inboundQueue, config.getThreadPoolInboundNumThreads()); } if (isTimerThreading) { timerQueue = makeQueue(config.getThreadPoolTimerExecCapacity()); timerThreadPool = getThreadPool(services.getRuntimeURI(), "TimerExec", timerQueue, config.getThreadPoolTimerExecNumThreads()); } if (isRouteThreading) { routeQueue = makeQueue(config.getThreadPoolRouteExecCapacity()); routeThreadPool = getThreadPool(services.getRuntimeURI(), "RouteExec", routeQueue, config.getThreadPoolRouteExecNumThreads()); } if (isOutboundThreading) { outboundQueue = makeQueue(config.getThreadPoolOutboundCapacity()); outboundThreadPool = getThreadPool(services.getRuntimeURI(), "Outbound", outboundQueue, config.getThreadPoolOutboundNumThreads()); } }
private void processThreadWorkQueueLatchedSpin(InsertIntoLatchSpin insertIntoLatch) { // wait for the latch to complete EventBean eventBean = insertIntoLatch.await(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().qEvent(eventBean, services.getRuntimeURI(), false); } services.getEventProcessingRWLock().acquireReadLock(); try { processMatches(eventBean); } catch (RuntimeException ex) { matchesArrayThreadLocal.get().clear(); throw ex; } finally { insertIntoLatch.done(); services.getEventProcessingRWLock().releaseReadLock(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().aEvent(); } } dispatch(); }
private void processThreadWorkQueueLatchedWait(InsertIntoLatchWait insertIntoLatch) { // wait for the latch to complete EventBean eventBean = insertIntoLatch.await(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().qEvent(eventBean, services.getRuntimeURI(), false); } services.getEventProcessingRWLock().acquireReadLock(); try { processMatches(eventBean); } catch (RuntimeException ex) { matchesArrayThreadLocal.get().clear(); throw ex; } finally { insertIntoLatch.done(); services.getEventProcessingRWLock().releaseReadLock(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().aEvent(); } } dispatch(); }
public void processWrappedEvent(EventBean eventBean) { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().qStimulantEvent(eventBean, services.getRuntimeURI()); InstrumentationHelper.get().qEvent(eventBean, services.getRuntimeURI(), true);
public void advanceTime(long time) { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().qStimulantTime(services.getSchedulingService().getTime(), time, time, false, null, services.getRuntimeURI()); } services.getSchedulingService().setTime(time); services.getMetricReportingService().processTimeEvent(time); processSchedule(time); // Let listeners know of results dispatch(); // Work off the event queue if any events accumulated in there via a route() processThreadWorkQueue(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().aStimulantTime(); } }
private void processSchedule(long time) { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().qTime(time, services.getRuntimeURI()); } ArrayBackedCollection<ScheduleHandle> handles = scheduleArrayThreadLocal.get(); // Evaluation of schedules is protected by an optional scheduling service lock and then the runtimelock // We want to stay in this order for allowing the runtimelock as a second-order lock to the // services own lock, if it has one. services.getEventProcessingRWLock().acquireReadLock(); try { services.getSchedulingService().evaluate(handles); } finally { services.getEventProcessingRWLock().releaseReadLock(); } services.getEventProcessingRWLock().acquireReadLock(); try { processScheduleHandles(handles); } catch (RuntimeException ex) { handles.clear(); throw ex; } finally { services.getEventProcessingRWLock().releaseReadLock(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().aTime(); } } }
private void dispatchOnDeploymentEvent(DeploymentInternal deployed) { CopyOnWriteArrayList<DeploymentStateListener> listeners = services.getDeploymentLifecycleService().getListeners(); if (listeners.isEmpty()) { return; } EPStatement[] stmts = deployed.getStatements(); DeploymentStateEventDeployed event = new DeploymentStateEventDeployed(services.getRuntimeURI(), deployed.getDeploymentId(), deployed.getModuleProvider().getModuleName(), stmts); for (DeploymentStateListener listener : listeners) { try { listener.onDeployment(event); } catch (Throwable t) { handleDeploymentEventListenerException("on-deployment", t); } } }
destroyEngineMetrics(runtimeEnvironment.getServices().getRuntimeURI());
private void dispatchOnUndeploymentEvent(DeploymentInternal result) { CopyOnWriteArrayList<DeploymentStateListener> listeners = services.getDeploymentLifecycleService().getListeners(); if (listeners.isEmpty()) { return; } EPStatement[] statements = result.getStatements(); DeploymentStateEventUndeployed event = new DeploymentStateEventUndeployed(services.getRuntimeURI(), result.getDeploymentId(), result.getModuleProvider().getModuleName(), statements); for (DeploymentStateListener listener : listeners) { try { listener.onUndeployment(event); } catch (Throwable t) { handleDeploymentEventListenerException("on-undeployment", t); } } }
InstrumentationHelper.get().qStimulantTime(services.getSchedulingService().getTime(), currentTime, targetTime, true, optionalResolution, services.getRuntimeURI());
destroyEngineMetrics(runtimeEnvironment.getServices().getRuntimeURI());