public TimeProvider getTimeProvider() { return servicesContext.getSchedulingService(); }
public Long getNextScheduledTime() { return services.getSchedulingService().getNearestTimeHandle(); }
public long getCurrentTime() { return services.getSchedulingService().getTime(); }
public void setRuntime(EPRuntime runtime) { if (runtime == null) { throw new NullPointerException("runtime cannot be null"); } if (!(runtime instanceof EPRuntimeSPI)) { throw new IllegalArgumentException("Invalid type of runtime"); } EPRuntimeSPI spi = (EPRuntimeSPI) runtime; processEvent = spi.getEventService(); schedulingService = spi.getServicesContext().getSchedulingService(); sender.setRuntime(processEvent); }
public Map<DeploymentIdNamePair, Long> getStatementNearestSchedules() { return getStatementNearestSchedulesInternal(services.getSchedulingService(), services.getStatementLifecycleService()); }
public void setRuntime(EPRuntime runtime) { if (runtime == null) { throw new NullPointerException("runtime cannot be null"); } if (!(runtime instanceof EPRuntimeSPI)) { throw new IllegalArgumentException("Invalid type of runtime"); } EPRuntimeSPI spi = (EPRuntimeSPI) runtime; processEvent = spi.getEventService(); schedulingService = spi.getServicesContext().getSchedulingService(); sender.setRuntime(processEvent); }
private void advanceTimeSpanInternal(long targetTime, Long optionalResolution) { long currentTime = services.getSchedulingService().getTime(); currentTime += optionalResolution; } else { Long nearest = services.getSchedulingService().getNearestTimeHandle(); if (nearest == null) { currentTime = targetTime; InstrumentationHelper.get().qStimulantTime(services.getSchedulingService().getTime(), currentTime, targetTime, true, optionalResolution, services.getRuntimeURI()); services.getSchedulingService().setTime(currentTime);
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(); } }
/** * Ctor. * * @param runtime - the runtime for the runtimeprocessEvent and services * @param usingRuntimeThread - true if the Adapter should set time by the scheduling service in the runtime, * false if it should set time externally through the calling thread * @param usingExternalTimer - true to use esper's external timer mechanism instead of internal timing * @param usingTimeSpanEvents - true for time span events */ public AbstractCoordinatedAdapter(EPRuntime runtime, boolean usingRuntimeThread, boolean usingExternalTimer, boolean usingTimeSpanEvents) { this.usingRuntimeThread = usingRuntimeThread; this.usingExternalTimer = usingExternalTimer; this.usingTimeSpanEvents = usingTimeSpanEvents; this.setSender(new DirectSender()); if (runtime == null) { return; } if (!(runtime instanceof EPRuntimeSPI)) { throw new IllegalArgumentException("Invalid runtime provided"); } this.runtime = runtime; this.processEvent = runtime.getEventService(); this.schedulingService = ((EPRuntimeSPI) runtime).getServicesContext().getSchedulingService(); }
/** * Ctor. * * @param runtime - the runtime for the runtimeprocessEvent and services * @param usingRuntimeThread - true if the Adapter should set time by the scheduling service in the runtime, * false if it should set time externally through the calling thread * @param usingExternalTimer - true to use esper's external timer mechanism instead of internal timing * @param usingTimeSpanEvents - true for time span events */ public AbstractCoordinatedAdapter(EPRuntime runtime, boolean usingRuntimeThread, boolean usingExternalTimer, boolean usingTimeSpanEvents) { this.usingRuntimeThread = usingRuntimeThread; this.usingExternalTimer = usingExternalTimer; this.usingTimeSpanEvents = usingTimeSpanEvents; this.setSender(new DirectSender()); if (runtime == null) { return; } if (!(runtime instanceof EPRuntimeSPI)) { throw new IllegalArgumentException("Invalid runtime provided"); } this.runtime = runtime; this.processEvent = runtime.getEventService(); this.schedulingService = ((EPRuntimeSPI) runtime).getServicesContext().getSchedulingService(); }
public static int scheduleCountOverall(RegressionEnvironment env) { EPRuntimeSPI spi = (EPRuntimeSPI) env.runtime(); ScheduleVisitorAll visitor = new ScheduleVisitorAll(); spi.getServicesContext().getSchedulingService().visitSchedules(visitor); return visitor.getCount(); }
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 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); }
services.getSchedulingService().setTime(startTime); services.getSchedulingService().init(); services.getMetricReportingService().setContext(services.getFilterService(), services.getSchedulingService(), eventService);