本文整理汇总了Java中com.espertech.esper.core.service.EPRuntimeIsolatedSPI类的典型用法代码示例。如果您正苦于以下问题:Java EPRuntimeIsolatedSPI类的具体用法?Java EPRuntimeIsolatedSPI怎么用?Java EPRuntimeIsolatedSPI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EPRuntimeIsolatedSPI类属于com.espertech.esper.core.service包,在下文中一共展示了EPRuntimeIsolatedSPI类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runAssertionNextScheduledTime
import com.espertech.esper.core.service.EPRuntimeIsolatedSPI; //导入依赖的package包/类
private void runAssertionNextScheduledTime(EPServiceProvider epService) {
EPRuntimeSPI runtimeSPI = (EPRuntimeSPI) epService.getEPRuntime();
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(0));
assertNull(epService.getEPRuntime().getNextScheduledTime());
assertSchedules(runtimeSPI.getStatementNearestSchedules(), new Object[0][]);
EPStatement stmtOne = epService.getEPAdministrator().createEPL("select * from pattern[timer:interval(2 sec)]");
assertEquals(2000L, (long) epService.getEPRuntime().getNextScheduledTime());
assertSchedules(runtimeSPI.getStatementNearestSchedules(), new Object[][]{{stmtOne.getName(), 2000L}});
EPStatement stmtTwo = epService.getEPAdministrator().createEPL("@Name('s2') select * from pattern[timer:interval(150 msec)]");
assertEquals(150L, (long) epService.getEPRuntime().getNextScheduledTime());
assertSchedules(runtimeSPI.getStatementNearestSchedules(), new Object[][]{{"s2", 150L}, {stmtOne.getName(), 2000L}});
stmtTwo.destroy();
assertEquals(2000L, (long) epService.getEPRuntime().getNextScheduledTime());
assertSchedules(runtimeSPI.getStatementNearestSchedules(), new Object[][]{{stmtOne.getName(), 2000L}});
EPStatement stmtThree = epService.getEPAdministrator().createEPL("select * from pattern[timer:interval(3 sec) and timer:interval(4 sec)]");
assertEquals(2000L, (long) epService.getEPRuntime().getNextScheduledTime());
assertSchedules(runtimeSPI.getStatementNearestSchedules(), new Object[][]{{stmtOne.getName(), 2000L}, {stmtThree.getName(), 3000L}});
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(2500));
assertEquals(3000L, (long) epService.getEPRuntime().getNextScheduledTime());
assertSchedules(runtimeSPI.getStatementNearestSchedules(), new Object[][]{{stmtThree.getName(), 3000L}});
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(3500));
assertEquals(4000L, (long) epService.getEPRuntime().getNextScheduledTime());
assertSchedules(runtimeSPI.getStatementNearestSchedules(), new Object[][]{{stmtThree.getName(), 4000L}});
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(4500));
assertEquals(null, epService.getEPRuntime().getNextScheduledTime());
assertSchedules(runtimeSPI.getStatementNearestSchedules(), new Object[0][]);
// test isolated service
EPServiceProviderIsolated isolated = epService.getEPServiceIsolated("I1");
EPRuntimeIsolatedSPI isolatedSPI = (EPRuntimeIsolatedSPI) isolated.getEPRuntime();
isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(0));
assertNull(isolated.getEPRuntime().getNextScheduledTime());
assertSchedules(isolatedSPI.getStatementNearestSchedules(), new Object[0][]);
EPStatement stmtFour = isolated.getEPAdministrator().createEPL("select * from pattern[timer:interval(2 sec)]", null, null);
assertEquals(2000L, (long) isolatedSPI.getNextScheduledTime());
assertSchedules(isolatedSPI.getStatementNearestSchedules(), new Object[][]{{stmtFour.getName(), 2000L}});
isolated.destroy();
epService.getEPAdministrator().destroyAllStatements();
}
示例2: testNextScheduledTime
import com.espertech.esper.core.service.EPRuntimeIsolatedSPI; //导入依赖的package包/类
public void testNextScheduledTime() {
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(0));
assertNull(epService.getEPRuntime().getNextScheduledTime());
assertSchedules(runtimeSPI.getStatementNearestSchedules(), new Object[0][]);
EPStatement stmtOne = epService.getEPAdministrator().createEPL("select * from pattern[timer:interval(2 sec)]");
assertEquals(2000L, (long) epService.getEPRuntime().getNextScheduledTime());
assertSchedules(runtimeSPI.getStatementNearestSchedules(), new Object[][] {{stmtOne.getName(), 2000L}});
EPStatement stmtTwo = epService.getEPAdministrator().createEPL("@Name('s2') select * from pattern[timer:interval(150 msec)]");
assertEquals(150L, (long) epService.getEPRuntime().getNextScheduledTime());
assertSchedules(runtimeSPI.getStatementNearestSchedules(), new Object[][] {{"s2", 150L}, {stmtOne.getName(), 2000L}});
stmtTwo.destroy();
assertEquals(2000L, (long) epService.getEPRuntime().getNextScheduledTime());
assertSchedules(runtimeSPI.getStatementNearestSchedules(), new Object[][] {{stmtOne.getName(), 2000L}});
EPStatement stmtThree = epService.getEPAdministrator().createEPL("select * from pattern[timer:interval(3 sec) and timer:interval(4 sec)]");
assertEquals(2000L, (long) epService.getEPRuntime().getNextScheduledTime());
assertSchedules(runtimeSPI.getStatementNearestSchedules(), new Object[][] {{stmtOne.getName(), 2000L}, {stmtThree.getName(), 3000L}});
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(2500));
assertEquals(3000L, (long) epService.getEPRuntime().getNextScheduledTime());
assertSchedules(runtimeSPI.getStatementNearestSchedules(), new Object[][] {{stmtThree.getName(), 3000L}});
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(3500));
assertEquals(4000L, (long) epService.getEPRuntime().getNextScheduledTime());
assertSchedules(runtimeSPI.getStatementNearestSchedules(), new Object[][] {{stmtThree.getName(), 4000L}});
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(4500));
assertEquals(null, epService.getEPRuntime().getNextScheduledTime());
assertSchedules(runtimeSPI.getStatementNearestSchedules(), new Object[0][]);
// test isolated service
EPServiceProviderIsolated isolated = epService.getEPServiceIsolated("I1");
EPRuntimeIsolatedSPI isolatedSPI = (EPRuntimeIsolatedSPI) isolated.getEPRuntime();
isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(0));
assertNull(isolated.getEPRuntime().getNextScheduledTime());
assertSchedules(isolatedSPI.getStatementNearestSchedules(), new Object[0][]);
EPStatement stmtFour = isolated.getEPAdministrator().createEPL("select * from pattern[timer:interval(2 sec)]", null, null);
assertEquals(2000L, (long) isolatedSPI.getNextScheduledTime());
assertSchedules(isolatedSPI.getStatementNearestSchedules(), new Object[][] {{stmtFour.getName(), 2000L}});
}