use of io.siddhi.core.util.event.handler.EventExchangeHolder in project siddhi by wso2.
the class StreamJunction method sendEvent.
private void sendEvent(Event[] events) {
if (throughputTracker != null && Level.BASIC.compareTo(siddhiAppContext.getRootMetricsLevel()) <= 0) {
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 {
EventExchangeHolder eventExchangeHolder = ringBuffer.get(sequenceNo);
eventExchangeHolder.getEvent().copyFrom(event);
eventExchangeHolder.getAndSetIsProcessed(false);
} finally {
ringBuffer.publish(sequenceNo);
}
}
} else {
for (Receiver receiver : receivers) {
receiver.receive(events);
}
}
}
use of io.siddhi.core.util.event.handler.EventExchangeHolder 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 && Level.BASIC.compareTo(siddhiAppContext.getRootMetricsLevel()) <= 0) {
throughputTracker.eventIn();
}
long sequenceNo = ringBuffer.next();
try {
EventExchangeHolder eventExchangeHolder = ringBuffer.get(sequenceNo);
eventExchangeHolder.getEvent().copyFrom(complexEventList);
eventExchangeHolder.getAndSetIsProcessed(false);
} finally {
ringBuffer.publish(sequenceNo);
}
complexEventList = complexEventList.getNext();
}
} else {
if (throughputTracker != null && Level.BASIC.compareTo(siddhiAppContext.getRootMetricsLevel()) <= 0) {
int messageCount = 0;
while (complexEventList != null) {
messageCount++;
complexEventList = complexEventList.getNext();
}
throughputTracker.eventsIn(messageCount);
}
for (Receiver receiver : receivers) {
receiver.receive(complexEvent);
}
}
}
use of io.siddhi.core.util.event.handler.EventExchangeHolder in project siddhi by wso2.
the class StreamJunction method sendEvent.
private void sendEvent(List<Event> events) {
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 {
EventExchangeHolder eventExchangeHolder = ringBuffer.get(sequenceNo);
eventExchangeHolder.getEvent().copyFrom(event);
eventExchangeHolder.getAndSetIsProcessed(false);
} finally {
ringBuffer.publish(sequenceNo);
}
}
} else {
for (Receiver receiver : receivers) {
receiver.receive(events.toArray(new Event[events.size()]));
}
}
}
use of io.siddhi.core.util.event.handler.EventExchangeHolder in project siddhi by wso2.
the class StreamJunction method sendEvent.
public void sendEvent(Event event) {
if (throughputTracker != null && Level.BASIC.compareTo(siddhiAppContext.getRootMetricsLevel()) <= 0) {
throughputTracker.eventIn();
}
if (isTraceEnabled) {
log.trace(event + " event is received by streamJunction " + this);
}
if (disruptor != null) {
long sequenceNo = ringBuffer.next();
try {
EventExchangeHolder eventExchangeHolder = ringBuffer.get(sequenceNo);
eventExchangeHolder.getEvent().copyFrom(event);
eventExchangeHolder.getAndSetIsProcessed(false);
} finally {
ringBuffer.publish(sequenceNo);
}
} else {
for (Receiver receiver : receivers) {
receiver.receive(event);
}
}
}
use of io.siddhi.core.util.event.handler.EventExchangeHolder in project siddhi by wso2.
the class StreamJunction method sendData.
private void sendData(long timeStamp, Object[] data) {
if (throughputTracker != null && Level.BASIC.compareTo(siddhiAppContext.getRootMetricsLevel()) <= 0) {
throughputTracker.eventIn();
}
if (disruptor != null) {
long sequenceNo = ringBuffer.next();
try {
EventExchangeHolder eventExchangeHolder = ringBuffer.get(sequenceNo);
eventExchangeHolder.getAndSetIsProcessed(false);
eventExchangeHolder.getEvent().setTimestamp(timeStamp);
eventExchangeHolder.getEvent().setIsExpired(false);
System.arraycopy(data, 0, eventExchangeHolder.getEvent().getData(), 0, data.length);
} finally {
ringBuffer.publish(sequenceNo);
}
} else {
for (Receiver receiver : receivers) {
receiver.receive(timeStamp, data);
}
}
}
Aggregations