use of org.wso2.siddhi.core.util.Scheduler in project siddhi by wso2.
the class AllAggregationGroupByWindowedPerSnapshotOutputRateLimiter method start.
@Override
public void start() {
scheduler = SchedulerParser.parse(scheduledExecutorService, this, siddhiAppContext);
scheduler.setStreamEventPool(new StreamEventPool(0, 0, 0, 5));
scheduler.init(lockWrapper, queryName);
long currentTime = System.currentTimeMillis();
scheduledTime = currentTime + value;
scheduler.notifyAt(scheduledTime);
}
use of org.wso2.siddhi.core.util.Scheduler in project siddhi by wso2.
the class AllAggregationPerSnapshotOutputRateLimiter method start.
@Override
public void start() {
scheduler = SchedulerParser.parse(scheduledExecutorService, this, siddhiAppContext);
scheduler.setStreamEventPool(new StreamEventPool(0, 0, 0, 5));
scheduler.init(lockWrapper, queryName);
long currentTime = System.currentTimeMillis();
scheduledTime = currentTime + value;
scheduler.notifyAt(scheduledTime);
}
use of org.wso2.siddhi.core.util.Scheduler in project siddhi by wso2.
the class GroupByPerSnapshotOutputRateLimiter method process.
/**
* Sends the collected unique outputs per group by key upon arrival of timer event from scheduler.
*
* @param complexEventChunk Incoming {@link org.wso2.siddhi.core.event.ComplexEventChunk}
*/
@Override
public void process(ComplexEventChunk complexEventChunk) {
List<ComplexEventChunk<ComplexEvent>> outputEventChunks = new ArrayList<ComplexEventChunk<ComplexEvent>>();
complexEventChunk.reset();
synchronized (this) {
complexEventChunk.reset();
while (complexEventChunk.hasNext()) {
ComplexEvent event = complexEventChunk.next();
if (event.getType() == ComplexEvent.Type.TIMER) {
tryFlushEvents(outputEventChunks, event);
} else if (event.getType() == ComplexEvent.Type.CURRENT) {
complexEventChunk.remove();
tryFlushEvents(outputEventChunks, event);
GroupedComplexEvent groupedComplexEvent = ((GroupedComplexEvent) event);
groupByKeyEvents.put(groupedComplexEvent.getGroupKey(), groupedComplexEvent.getComplexEvent());
}
}
}
for (ComplexEventChunk eventChunk : outputEventChunks) {
sendToCallBacks(eventChunk);
}
}
use of org.wso2.siddhi.core.util.Scheduler in project siddhi by wso2.
the class GroupByPerSnapshotOutputRateLimiter method start.
@Override
public void start() {
scheduler = SchedulerParser.parse(scheduledExecutorService, this, siddhiAppContext);
scheduler.setStreamEventPool(new StreamEventPool(0, 0, 0, 5));
scheduler.init(lockWrapper, queryName);
long currentTime = System.currentTimeMillis();
scheduledTime = currentTime + value;
scheduler.notifyAt(scheduledTime);
}
use of org.wso2.siddhi.core.util.Scheduler in project siddhi by wso2.
the class AbsentLogicalPreStateProcessor method cloneProcessor.
@Override
public PreStateProcessor cloneProcessor(String key) {
AbsentLogicalPreStateProcessor logicalPreStateProcessor = new AbsentLogicalPreStateProcessor(logicalType, stateType, withinStates, waitingTimeConstant);
cloneProperties(logicalPreStateProcessor, key);
logicalPreStateProcessor.init(siddhiAppContext, queryName);
// Set the scheduler
siddhiAppContext.addEternalReferencedHolder(logicalPreStateProcessor);
EntryValveProcessor entryValveProcessor = new EntryValveProcessor(siddhiAppContext);
entryValveProcessor.setToLast(logicalPreStateProcessor);
Scheduler scheduler = SchedulerParser.parse(siddhiAppContext.getScheduledExecutorService(), entryValveProcessor, siddhiAppContext);
logicalPreStateProcessor.setScheduler(scheduler);
return logicalPreStateProcessor;
}
Aggregations