本文整理汇总了Java中com.espertech.esper.timer.TimeSourceServiceImpl类的典型用法代码示例。如果您正苦于以下问题:Java TimeSourceServiceImpl类的具体用法?Java TimeSourceServiceImpl怎么用?Java TimeSourceServiceImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TimeSourceServiceImpl类属于com.espertech.esper.timer包,在下文中一共展示了TimeSourceServiceImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate3Stream
import com.espertech.esper.timer.TimeSourceServiceImpl; //导入依赖的package包/类
public static void validate3Stream(ExprNode topNode) throws Exception {
SupportStreamTypeSvc3Stream streamTypeService = new SupportStreamTypeSvc3Stream();
ViewFactoryChain[] factoriesPerStream = new ViewFactoryChain[3];
for (int i = 0; i < factoriesPerStream.length; i++) {
List<ViewFactory> factories = new LinkedList<ViewFactory>();
factories.add(new LengthWindowViewFactory());
factoriesPerStream[i] = new ViewFactoryChain(streamTypeService.getEventTypes()[i], factories);
}
ViewResourceDelegateUnverified viewResources = new ViewResourceDelegateUnverified();
VariableService variableService = new VariableServiceImpl(0, new SchedulingServiceImpl(new TimeSourceServiceImpl()), SupportEventAdapterService.getService(), null);
variableService.createNewVariable(null, "intPrimitive", Integer.class.getName(), false, false, false, 10, SupportEngineImportServiceFactory.make());
variableService.allocateVariableState("intPrimitive", EPStatementStartMethod.DEFAULT_AGENT_INSTANCE_ID, null, false);
variableService.createNewVariable(null, "var1", String.class.getName(), false, false, false, "my_variable_value", SupportEngineImportServiceFactory.make());
variableService.allocateVariableState("var1", EPStatementStartMethod.DEFAULT_AGENT_INSTANCE_ID, null, false);
ExprNodeUtilityRich.getValidatedSubtree(ExprNodeOrigin.SELECT, topNode, new ExprValidationContext(streamTypeService, SupportEngineImportServiceFactory.make(), null, viewResources, null, variableService, null, new SupportExprEvaluatorContext(null), null, null, 1, null, null, false, false, false, false, null, false));
}
示例2: validate3Stream
import com.espertech.esper.timer.TimeSourceServiceImpl; //导入依赖的package包/类
public static void validate3Stream(ExprNode topNode) throws Exception {
SupportStreamTypeSvc3Stream streamTypeService = new SupportStreamTypeSvc3Stream();
ViewFactoryChain[] factoriesPerStream = new ViewFactoryChain[3];
for (int i = 0; i < factoriesPerStream.length; i++) {
List<ViewFactory> factories = new LinkedList<ViewFactory>();
factories.add(new LengthWindowViewFactory());
factoriesPerStream[i] = new ViewFactoryChain(streamTypeService.getEventTypes()[i], factories);
}
ViewResourceDelegateUnverified viewResources = new ViewResourceDelegateUnverified();
EngineImportService engineImportService = SupportEngineImportServiceFactory.make();
VariableService variableService = new VariableServiceImpl(0, new SchedulingServiceImpl(new TimeSourceServiceImpl()), SupportEventAdapterService.getService(), null);
variableService.createNewVariable(null, "intPrimitive", Integer.class.getName(), false, false, false, 10, engineImportService);
variableService.allocateVariableState("intPrimitive", EPStatementStartMethod.DEFAULT_AGENT_INSTANCE_ID, null, false);
variableService.createNewVariable(null, "var1", String.class.getName(), false, false, false, "my_variable_value", engineImportService);
variableService.allocateVariableState("var1", EPStatementStartMethod.DEFAULT_AGENT_INSTANCE_ID, null, false);
ExprNodeUtilityRich.getValidatedSubtree(ExprNodeOrigin.SELECT, topNode, new ExprValidationContext(streamTypeService, SupportEngineImportServiceFactory.make(), null, viewResources, null, variableService, null, new SupportExprEvaluatorContext(null), null, null, 1, null, null, false, false, false, false, null, false));
}
示例3: setUp
import com.espertech.esper.timer.TimeSourceServiceImpl; //导入依赖的package包/类
public void setUp() {
service = new SchedulingServiceImpl(new TimeSourceServiceImpl());
mgmtService = new SchedulingMgmtServiceImpl();
// 2-by-2 table of buckets and slots
ScheduleBucket[] buckets = new ScheduleBucket[3];
slots = new long[buckets.length][2];
for (int i = 0; i < buckets.length; i++) {
buckets[i] = mgmtService.allocateBucket();
slots[i] = new long[2];
for (int j = 0; j < slots[i].length; j++) {
slots[i][j] = buckets[i].allocateSlot();
}
}
callbacks = new SupportScheduleCallback[5];
for (int i = 0; i < callbacks.length; i++) {
callbacks[i] = new SupportScheduleCallback();
}
}
示例4: testRollover
import com.espertech.esper.timer.TimeSourceServiceImpl; //导入依赖的package包/类
public void testRollover() throws Exception {
service = new VariableServiceImpl(VariableServiceImpl.ROLLOVER_READER_BOUNDARY - 100, 10000, new SchedulingServiceImpl(new TimeSourceServiceImpl()), SupportEventAdapterService.getService(), null);
String[] variables = "a,b,c,d".split(",");
VariableReader readers[] = new VariableReader[variables.length];
for (int i = 0; i < variables.length; i++) {
service.createNewVariable(null, variables[i], Long.class.getName(), false, false, false, 100L, engineImportService);
service.allocateVariableState(variables[i], EPStatementStartMethod.DEFAULT_AGENT_INSTANCE_ID, null, false);
readers[i] = service.getReader(variables[i], EPStatementStartMethod.DEFAULT_AGENT_INSTANCE_ID);
}
for (int i = 0; i < 1000; i++) {
for (int j = 0; j < variables.length; j++) {
service.write(readers[j].getVariableMetaData().getVariableNumber(), EPStatementStartMethod.DEFAULT_AGENT_INSTANCE_ID, 100L + i);
service.commit();
}
readCompare(variables, 100L + i);
}
}
示例5: setUp
import com.espertech.esper.timer.TimeSourceServiceImpl; //导入依赖的package包/类
public void setUp()
{
service = new SchedulingServiceImpl(new TimeSourceServiceImpl());
mgmtService = new SchedulingMgmtServiceImpl();
// 2-by-2 table of buckets and slots
ScheduleBucket[] buckets = new ScheduleBucket[3];
slots = new ScheduleSlot[buckets.length][2];
for (int i = 0; i < buckets.length; i++)
{
buckets[i] = mgmtService.allocateBucket();
slots[i] = new ScheduleSlot[2];
for (int j = 0; j < slots[i].length; j++)
{
slots[i][j] = buckets[i].allocateSlot();
}
}
callbacks = new SupportScheduleCallback[5];
for (int i= 0; i < callbacks.length; i++)
{
callbacks[i] = new SupportScheduleCallback();
}
}
示例6: validate3Stream
import com.espertech.esper.timer.TimeSourceServiceImpl; //导入依赖的package包/类
public static void validate3Stream(ExprNode topNode) throws Exception
{
SupportStreamTypeSvc3Stream streamTypeService = new SupportStreamTypeSvc3Stream();
ViewFactoryChain[] factoriesPerStream = new ViewFactoryChain[3];
for (int i = 0; i < factoriesPerStream.length; i++)
{
List<ViewFactory> factories = new LinkedList<ViewFactory>();
factories.add(new LengthWindowViewFactory());
factoriesPerStream[i] = new ViewFactoryChain(streamTypeService.getEventTypes()[i], factories);
}
ViewResourceDelegateUnverified viewResources = new ViewResourceDelegateUnverified();
VariableService variableService = new VariableServiceImpl(0, new SchedulingServiceImpl(new TimeSourceServiceImpl()), SupportEventAdapterService.getService(), null);
variableService.createNewVariable("intPrimitive", Integer.class.getName(), 10, false, false, null, null);
variableService.createNewVariable("var1", String.class.getName(), "my_variable_value", false, false, null, null);
ExprNodeUtility.getValidatedSubtree(topNode, new ExprValidationContext(streamTypeService, getMethodResService(), viewResources, null, variableService, null, null, null, null, null, null));
}
示例7: testRollover
import com.espertech.esper.timer.TimeSourceServiceImpl; //导入依赖的package包/类
public void testRollover() throws Exception
{
service = new VariableServiceImpl(VariableServiceImpl.ROLLOVER_READER_BOUNDARY - 100, 10000, new SchedulingServiceImpl(new TimeSourceServiceImpl()), SupportEventAdapterService.getService(), null);
String[] variables = "a,b,c,d".split(",");
VariableReader readers[] = new VariableReader[variables.length];
for (int i = 0; i < variables.length; i++)
{
service.createNewVariable(variables[i], Long.class.getName(), 100L, false, false, null, null);
readers[i] = service.getReader(variables[i]);
}
for (int i = 0; i < 1000; i++)
{
for (int j = 0; j < variables.length; j++)
{
service.write(readers[j].getVariableNumber(), 100L + i);
service.commit();
}
readCompare(variables, 100L + i);
}
}
示例8: makeTimeSource
import com.espertech.esper.timer.TimeSourceServiceImpl; //导入依赖的package包/类
/**
* Makes the time source provider.
*
* @param configSnapshot the configuration
* @return time source provider
*/
protected static TimeSourceService makeTimeSource(ConfigurationInformation configSnapshot) {
if (configSnapshot.getEngineDefaults().getTimeSource().getTimeSourceType() == ConfigurationEngineDefaults.TimeSourceType.NANO) {
// this is a static variable to keep overhead down for getting a current time
TimeSourceServiceImpl.isSystemCurrentTime = false;
}
return new TimeSourceServiceImpl();
}
示例9: setUp
import com.espertech.esper.timer.TimeSourceServiceImpl; //导入依赖的package包/类
public void setUp() {
StatementContext stmtContext = SupportStatementContextFactory.makeContext(new SchedulingServiceImpl(new TimeSourceServiceImpl()));
scheduleService = stmtContext.getSchedulingService();
PatternAgentInstanceContext agentInstanceContext = SupportPatternContextFactory.makePatternAgentInstanceContext(scheduleService);
quitable = new SupportQuitable(agentInstanceContext);
guard = new TimerWithinGuard(1000, quitable);
}
示例10: setUp
import com.espertech.esper.timer.TimeSourceServiceImpl; //导入依赖的package包/类
public void setUp() {
StatementContext stmtContext = SupportStatementContextFactory.makeContext(new SchedulingServiceImpl(new TimeSourceServiceImpl()));
scheduleService = stmtContext.getSchedulingService();
PatternAgentInstanceContext agentInstanceContext = SupportPatternContextFactory.makePatternAgentInstanceContext(scheduleService);
quitable = new SupportQuitable(agentInstanceContext);
guard = new TimerWithinOrMaxCountGuard(1000, 2, quitable);
}
示例11: testPurgeInterval
import com.espertech.esper.timer.TimeSourceServiceImpl; //导入依赖的package包/类
public void testPurgeInterval() {
SchedulingServiceImpl scheduler = new SchedulingServiceImpl(new TimeSourceServiceImpl());
cache = new DataCacheExpiringImpl(10, 20, ConfigurationCacheReferenceType.HARD, scheduler, 1, null, TimeAbacusMilliseconds.INSTANCE); // age 10 sec, purge 1000 seconds
// test single entry in cache
scheduler.setTime(5000);
cache.put(make("a"), 1, new EventTable[]{lists[0]}); // a at 5 sec
assertSame(lists[0], cache.getCached(make("a"), 1)[0]);
scheduler.setTime(26000);
SupportSchedulingServiceImpl.evaluateSchedule(scheduler);
assertEquals(0, cache.getSize());
// test 4 entries in cache
scheduler.setTime(30000);
cache.put(make("b"), 1, new EventTable[]{lists[1]}); // b at 30 sec
scheduler.setTime(35000);
cache.put(make("c"), 1, new EventTable[]{lists[2]}); // c at 35 sec
scheduler.setTime(40000);
cache.put(make("d"), 1, new EventTable[]{lists[3]}); // d at 40 sec
scheduler.setTime(45000);
cache.put(make("e"), 1, new EventTable[]{lists[4]}); // d at 40 sec
scheduler.setTime(50000);
SupportSchedulingServiceImpl.evaluateSchedule(scheduler);
assertEquals(2, cache.getSize()); // only d and e
assertSame(lists[3], cache.getCached(make("d"), 1)[0]);
assertSame(lists[4], cache.getCached(make("e"), 1)[0]);
}
示例12: makeTimeSource
import com.espertech.esper.timer.TimeSourceServiceImpl; //导入依赖的package包/类
/**
* Makes the time source provider.
* @param configSnapshot the configuration
* @return time source provider
*/
protected static TimeSourceService makeTimeSource(ConfigurationInformation configSnapshot)
{
if (configSnapshot.getEngineDefaults().getTimeSource().getTimeSourceType() == ConfigurationEngineDefaults.TimeSourceType.NANO)
{
// this is a static variable to keep overhead down for getting a current time
TimeSourceServiceImpl.IS_SYSTEM_CURRENT_TIME = false;
}
return new TimeSourceServiceImpl();
}
示例13: setUp
import com.espertech.esper.timer.TimeSourceServiceImpl; //导入依赖的package包/类
public void setUp()
{
StatementContext stmtContext = SupportStatementContextFactory.makeContext(new SchedulingServiceImpl(new TimeSourceServiceImpl()));
scheduleService = stmtContext.getSchedulingService();
PatternAgentInstanceContext agentInstanceContext = SupportPatternContextFactory.makePatternAgentInstanceContext(scheduleService);
quitable = new SupportQuitable(agentInstanceContext);
guard = new TimerWithinGuard(1000, quitable);
}
示例14: setUp
import com.espertech.esper.timer.TimeSourceServiceImpl; //导入依赖的package包/类
public void setUp()
{
StatementContext stmtContext = SupportStatementContextFactory.makeContext(new SchedulingServiceImpl(new TimeSourceServiceImpl()));
scheduleService = stmtContext.getSchedulingService();
PatternAgentInstanceContext agentInstanceContext = SupportPatternContextFactory.makePatternAgentInstanceContext(scheduleService);
quitable = new SupportQuitable(agentInstanceContext);
guard = new TimerWithinOrMaxCountGuard(1000, 2, quitable);
}
示例15: setUp
import com.espertech.esper.timer.TimeSourceServiceImpl; //导入依赖的package包/类
public void setUp()
{
beginState = new MatchedEventMapImpl(new MatchedEventMapMeta(new String[0], false));
scheduleService = new SchedulingServiceImpl(new TimeSourceServiceImpl());
PatternAgentInstanceContext agentContext = SupportPatternContextFactory.makePatternAgentInstanceContext(scheduleService);
ScheduleSpec scheduleSpec = new ScheduleSpec();
scheduleSpec.addValue(ScheduleUnit.SECONDS, 1);
evaluator = new SupportObserverEvaluator(agentContext);
observer = new TimerAtObserver(scheduleSpec, beginState, evaluator);
}