use of org.wso2.siddhi.core.query.input.stream.single.SingleStreamRuntime in project siddhi by wso2.
the class SiddhiAppRuntime method debug.
public synchronized SiddhiDebugger debug() {
siddhiDebugger = new SiddhiDebugger(siddhiAppContext);
List<StreamRuntime> streamRuntime = new ArrayList<>();
List<OutputCallback> streamCallbacks = new ArrayList<>();
for (QueryRuntime queryRuntime : queryProcessorMap.values()) {
streamRuntime.add(queryRuntime.getStreamRuntime());
streamCallbacks.add(queryRuntime.getOutputCallback());
}
for (StreamRuntime streamRuntime1 : streamRuntime) {
for (SingleStreamRuntime singleStreamRuntime : streamRuntime1.getSingleStreamRuntimes()) {
singleStreamRuntime.getProcessStreamReceiver().setSiddhiDebugger(siddhiDebugger);
}
}
for (OutputCallback callback : streamCallbacks) {
callback.setSiddhiDebugger(siddhiDebugger);
}
start();
running = true;
return siddhiDebugger;
}
use of org.wso2.siddhi.core.query.input.stream.single.SingleStreamRuntime in project siddhi by wso2.
the class JoinStreamRuntime method clone.
@Override
public StreamRuntime clone(String key) {
JoinStreamRuntime joinStreamRuntime = new JoinStreamRuntime(siddhiAppContext, metaStateEvent);
for (SingleStreamRuntime singleStreamRuntime : singleStreamRuntimeList) {
joinStreamRuntime.addRuntime((SingleStreamRuntime) singleStreamRuntime.clone(key));
}
SingleStreamRuntime leftSingleStreamRuntime = joinStreamRuntime.getSingleStreamRuntimes().get(0);
SingleStreamRuntime rightSingleStreamRuntime = joinStreamRuntime.getSingleStreamRuntimes().get(1);
Processor lastLeftProcessor = leftSingleStreamRuntime.getProcessorChain();
while (!(lastLeftProcessor instanceof JoinProcessor)) {
lastLeftProcessor = lastLeftProcessor.getNextProcessor();
}
JoinProcessor leftPreJoinProcessor = (JoinProcessor) lastLeftProcessor;
WindowProcessor leftWindowProcessor = (WindowProcessor) leftPreJoinProcessor.getNextProcessor();
JoinProcessor leftPostJoinProcessor = (JoinProcessor) leftWindowProcessor.getNextProcessor();
Processor lastRightProcessor = rightSingleStreamRuntime.getProcessorChain();
while (!(lastRightProcessor instanceof JoinProcessor)) {
lastRightProcessor = lastRightProcessor.getNextProcessor();
}
JoinProcessor rightPreJoinProcessor = (JoinProcessor) lastRightProcessor;
WindowProcessor rightWindowProcessor = (WindowProcessor) rightPreJoinProcessor.getNextProcessor();
JoinProcessor rightPostJoinProcessor = (JoinProcessor) rightWindowProcessor.getNextProcessor();
rightPostJoinProcessor.setFindableProcessor((FindableProcessor) leftWindowProcessor);
rightPreJoinProcessor.setFindableProcessor((FindableProcessor) leftWindowProcessor);
leftPreJoinProcessor.setFindableProcessor((FindableProcessor) rightWindowProcessor);
leftPostJoinProcessor.setFindableProcessor((FindableProcessor) rightWindowProcessor);
return joinStreamRuntime;
}
use of org.wso2.siddhi.core.query.input.stream.single.SingleStreamRuntime in project siddhi by wso2.
the class SingleStreamRuntime method clone.
@Override
public StreamRuntime clone(String key) {
ProcessStreamReceiver clonedProcessStreamReceiver = this.processStreamReceiver.clone(key);
EntryValveProcessor entryValveProcessor = null;
SchedulingProcessor schedulingProcessor;
Processor clonedProcessorChain = null;
if (processorChain != null) {
if (!(processorChain instanceof QuerySelector || processorChain instanceof OutputRateLimiter)) {
clonedProcessorChain = processorChain.cloneProcessor(key);
if (clonedProcessorChain instanceof EntryValveProcessor) {
entryValveProcessor = (EntryValveProcessor) clonedProcessorChain;
}
}
Processor processor = processorChain.getNextProcessor();
while (processor != null) {
if (!(processor instanceof QuerySelector || processor instanceof OutputRateLimiter)) {
Processor clonedProcessor = processor.cloneProcessor(key);
clonedProcessorChain.setToLast(clonedProcessor);
if (clonedProcessor instanceof EntryValveProcessor) {
entryValveProcessor = (EntryValveProcessor) clonedProcessor;
} else if (clonedProcessor instanceof SchedulingProcessor) {
schedulingProcessor = (SchedulingProcessor) clonedProcessor;
schedulingProcessor.setScheduler(((SchedulingProcessor) processor).getScheduler().clone(key, entryValveProcessor));
}
}
processor = processor.getNextProcessor();
}
}
return new SingleStreamRuntime(clonedProcessStreamReceiver, clonedProcessorChain, metaComplexEvent);
}
use of org.wso2.siddhi.core.query.input.stream.single.SingleStreamRuntime in project siddhi by wso2.
the class LogicalInnerStateRuntime method clone.
@Override
public InnerStateRuntime clone(String key) {
InnerStateRuntime clonedInnerStateRuntime1 = innerStateRuntime1.clone(key);
InnerStateRuntime clonedInnerStateRuntime2 = innerStateRuntime2.clone(key);
LogicalPreStateProcessor logicalPreStateProcessor1 = (LogicalPreStateProcessor) clonedInnerStateRuntime1.getFirstProcessor();
LogicalPostStateProcessor logicalPostStateProcessor1 = (LogicalPostStateProcessor) clonedInnerStateRuntime1.getLastProcessor();
LogicalPreStateProcessor logicalPreStateProcessor2 = (LogicalPreStateProcessor) clonedInnerStateRuntime2.getFirstProcessor();
LogicalPostStateProcessor logicalPostStateProcessor2 = (LogicalPostStateProcessor) clonedInnerStateRuntime2.getLastProcessor();
logicalPostStateProcessor1.setPartnerPreStateProcessor(logicalPreStateProcessor2);
logicalPostStateProcessor2.setPartnerPreStateProcessor(logicalPreStateProcessor1);
logicalPostStateProcessor1.setPartnerPostStateProcessor(logicalPostStateProcessor2);
logicalPostStateProcessor2.setPartnerPostStateProcessor(logicalPostStateProcessor1);
logicalPreStateProcessor1.setPartnerStatePreProcessor(logicalPreStateProcessor2);
logicalPreStateProcessor2.setPartnerStatePreProcessor(logicalPreStateProcessor1);
LogicalInnerStateRuntime logicalInnerStateRuntime = new LogicalInnerStateRuntime(clonedInnerStateRuntime1, clonedInnerStateRuntime2, stateType);
logicalInnerStateRuntime.firstProcessor = clonedInnerStateRuntime1.getFirstProcessor();
logicalInnerStateRuntime.lastProcessor = clonedInnerStateRuntime2.getLastProcessor();
logicalInnerStateRuntime.getSingleStreamRuntimeList().addAll(clonedInnerStateRuntime2.getSingleStreamRuntimeList());
logicalInnerStateRuntime.getSingleStreamRuntimeList().addAll(clonedInnerStateRuntime1.getSingleStreamRuntimeList());
List<SingleStreamRuntime> runtimeList = logicalInnerStateRuntime.getSingleStreamRuntimeList();
for (int i = 0; i < runtimeList.size(); i++) {
String streamId = runtimeList.get(i).getProcessStreamReceiver().getStreamId();
for (int j = i; j < runtimeList.size(); j++) {
if (streamId.equals(runtimeList.get(j).getProcessStreamReceiver().getStreamId())) {
runtimeList.get(j).setProcessStreamReceiver(runtimeList.get(i).getProcessStreamReceiver());
}
}
}
return logicalInnerStateRuntime;
}
use of org.wso2.siddhi.core.query.input.stream.single.SingleStreamRuntime in project siddhi by wso2.
the class StreamInnerStateRuntime method clone.
@Override
public InnerStateRuntime clone(String key) {
StreamInnerStateRuntime streamInnerStateRuntime = new StreamInnerStateRuntime(stateType);
for (SingleStreamRuntime singleStreamRuntime : singleStreamRuntimeList) {
streamInnerStateRuntime.singleStreamRuntimeList.add((SingleStreamRuntime) singleStreamRuntime.clone(key));
}
Processor processor = streamInnerStateRuntime.singleStreamRuntimeList.get(0).getProcessorChain();
streamInnerStateRuntime.firstProcessor = (StreamPreStateProcessor) processor;
while (processor != null) {
if (processor instanceof StreamPostStateProcessor) {
streamInnerStateRuntime.lastProcessor = (StreamPostStateProcessor) processor;
break;
} else {
processor = processor.getNextProcessor();
}
}
((StreamPostStateProcessor) streamInnerStateRuntime.lastProcessor).setThisStatePreProcessor((StreamPreStateProcessor) streamInnerStateRuntime.firstProcessor);
((StreamPreStateProcessor) streamInnerStateRuntime.firstProcessor).setThisStatePostProcessor((StreamPostStateProcessor) streamInnerStateRuntime.lastProcessor);
((StreamPreStateProcessor) streamInnerStateRuntime.firstProcessor).setThisLastProcessor((StreamPostStateProcessor) streamInnerStateRuntime.lastProcessor);
return streamInnerStateRuntime;
}
Aggregations