use of org.wso2.siddhi.core.util.lock.LockWrapper in project siddhi by wso2.
the class AggregationWindowedPerSnapshotOutputRateLimiter 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.lock.LockWrapper in project siddhi by wso2.
the class PerSnapshotOutputRateLimiter 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.lock.LockWrapper in project siddhi by wso2.
the class Scheduler method sendTimerEvents.
/**
* Go through the timestamps stored in the {@link #toNotifyQueue} and send the TIMER events for the expired events.
*/
protected void sendTimerEvents() {
Long toNotifyTime = toNotifyQueue.peek();
long currentTime = siddhiAppContext.getTimestampGenerator().currentTime();
while (toNotifyTime != null && toNotifyTime - currentTime <= 0) {
toNotifyQueue.poll();
StreamEvent timerEvent = streamEventPool.borrowEvent();
timerEvent.setType(StreamEvent.Type.TIMER);
timerEvent.setTimestamp(toNotifyTime);
streamEventChunk.add(timerEvent);
if (lockWrapper != null) {
lockWrapper.lock();
}
threadBarrier.pass();
try {
if (siddhiAppContext.isStatsEnabled() && latencyTracker != null) {
try {
latencyTracker.markIn();
singleThreadEntryValve.process(streamEventChunk);
} finally {
latencyTracker.markOut();
}
} else {
singleThreadEntryValve.process(streamEventChunk);
}
} finally {
if (lockWrapper != null) {
lockWrapper.unlock();
}
}
streamEventChunk.clear();
toNotifyTime = toNotifyQueue.peek();
currentTime = siddhiAppContext.getTimestampGenerator().currentTime();
}
}
Aggregations