use of org.wso2.siddhi.core.util.statistics.ThroughputTracker in project siddhi by wso2.
the class StreamJunction method sendData.
private void sendData(long timeStamp, Object[] data) {
// Set timestamp to system if Siddhi is in playback mode
if (siddhiAppContext.isPlayback()) {
((EventTimeBasedMillisTimestampGenerator) this.siddhiAppContext.getTimestampGenerator()).setCurrentTimestamp(timeStamp);
}
if (throughputTracker != null && siddhiAppContext.isStatsEnabled()) {
throughputTracker.eventIn();
}
if (disruptor != null) {
long sequenceNo = ringBuffer.next();
try {
Event existingEvent = ringBuffer.get(sequenceNo);
existingEvent.setTimestamp(timeStamp);
existingEvent.setIsExpired(false);
System.arraycopy(data, 0, existingEvent.getData(), 0, data.length);
} finally {
ringBuffer.publish(sequenceNo);
}
} else {
for (Receiver receiver : receivers) {
receiver.receive(timeStamp, data);
}
}
}
use of org.wso2.siddhi.core.util.statistics.ThroughputTracker in project siddhi by wso2.
the class StreamJunction method sendEvent.
public void sendEvent(ComplexEvent complexEvent) {
if (isTraceEnabled) {
log.trace("Event is received by streamJunction " + this);
}
ComplexEvent complexEventList = complexEvent;
if (disruptor != null) {
while (complexEventList != null) {
if (throughputTracker != null && siddhiAppContext.isStatsEnabled()) {
throughputTracker.eventIn();
}
long sequenceNo = ringBuffer.next();
try {
Event existingEvent = ringBuffer.get(sequenceNo);
existingEvent.copyFrom(complexEventList);
} finally {
ringBuffer.publish(sequenceNo);
}
complexEventList = complexEventList.getNext();
}
} else {
if (throughputTracker != null && siddhiAppContext.isStatsEnabled()) {
int messageCount = 0;
while (complexEventList != null) {
messageCount++;
complexEventList = complexEventList.getNext();
}
throughputTracker.eventsIn(messageCount);
}
for (Receiver receiver : receivers) {
receiver.receive(complexEvent);
}
}
}
use of org.wso2.siddhi.core.util.statistics.ThroughputTracker in project siddhi by wso2.
the class StreamJunction method sendEvent.
public void sendEvent(Event event) {
if (throughputTracker != null && siddhiAppContext.isStatsEnabled()) {
throughputTracker.eventIn();
}
if (isTraceEnabled) {
log.trace(event + " event is received by streamJunction " + this);
}
if (disruptor != null) {
long sequenceNo = ringBuffer.next();
try {
Event existingEvent = ringBuffer.get(sequenceNo);
existingEvent.copyFrom(event);
} finally {
ringBuffer.publish(sequenceNo);
}
} else {
for (Receiver receiver : receivers) {
receiver.receive(event);
}
}
}
use of org.wso2.siddhi.core.util.statistics.ThroughputTracker in project siddhi by wso2.
the class StreamJunction method sendEvent.
private void sendEvent(Event[] events) {
if (throughputTracker != null && siddhiAppContext.isStatsEnabled()) {
throughputTracker.eventsIn(events.length);
}
if (isTraceEnabled) {
log.trace("Event is received by streamJunction " + this);
}
if (disruptor != null) {
for (Event event : events) {
// Todo : optimize for arrays
long sequenceNo = ringBuffer.next();
try {
Event existingEvent = ringBuffer.get(sequenceNo);
existingEvent.copyFrom(event);
} finally {
ringBuffer.publish(sequenceNo);
}
}
} else {
for (Receiver receiver : receivers) {
receiver.receive(events);
}
}
}
use of org.wso2.siddhi.core.util.statistics.ThroughputTracker in project siddhi by wso2.
the class CronTrigger method sendEvent.
private void sendEvent() {
long currentTime = siddhiAppContext.getTimestampGenerator().currentTime();
if (throughputTracker != null && siddhiAppContext.isStatsEnabled()) {
throughputTracker.eventIn();
}
streamJunction.sendEvent(new Event(currentTime, new Object[] { currentTime }));
}
Aggregations