本文整理汇总了Java中org.wso2.siddhi.core.stream.StreamJunction类的典型用法代码示例。如果您正苦于以下问题:Java StreamJunction类的具体用法?Java StreamJunction怎么用?Java StreamJunction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StreamJunction类属于org.wso2.siddhi.core.stream包,在下文中一共展示了StreamJunction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerForBufferedEvents
import org.wso2.siddhi.core.stream.StreamJunction; //导入依赖的package包/类
private void registerForBufferedEvents(Map.Entry<String, StreamJunction> entry) {
if (entry.getValue().containsBufferedEvents()) {
String metricName = siddhiAppContext.getSiddhiContext().getStatisticsConfiguration().getMetricPrefix() +
SiddhiConstants.METRIC_DELIMITER + SiddhiConstants.METRIC_INFIX_SIDDHI_APPS +
SiddhiConstants.METRIC_DELIMITER + getName() + SiddhiConstants.METRIC_DELIMITER +
SiddhiConstants.METRIC_INFIX_SIDDHI + SiddhiConstants.METRIC_DELIMITER +
SiddhiConstants.METRIC_INFIX_STREAMS + SiddhiConstants.METRIC_DELIMITER +
entry.getKey() + SiddhiConstants.METRIC_DELIMITER + "size";
boolean matchExist = false;
for (String regex : siddhiAppContext.getIncludedMetrics()) {
if (metricName.matches(regex)) {
matchExist = true;
break;
}
}
if (matchExist) {
bufferedEventsTracker.registerEventBufferHolder(entry.getValue(), metricName);
}
}
}
示例2: addStreamJunction
import org.wso2.siddhi.core.stream.StreamJunction; //导入依赖的package包/类
/**
* create local streamJunctions through which events received by partitionStreamReceiver, are sent to
* queryStreamReceivers
*
* @param key partitioning key
* @param queryRuntimeList queryRuntime list of the partition
*/
public void addStreamJunction(String key, List<QueryRuntime> queryRuntimeList) {
StreamJunction streamJunction = cachedStreamJunctionMap.get(streamId + key);
if (streamJunction == null) {
streamJunction = partitionRuntime.getLocalStreamJunctionMap().get(streamId + key);
if (streamJunction == null) {
streamJunction = createStreamJunction();
partitionRuntime.addStreamJunction(streamId + key, streamJunction);
}
cachedStreamJunctionMap.put(streamId + key, streamJunction);
}
for (QueryRuntime queryRuntime : queryRuntimeList) {
StreamRuntime streamRuntime = queryRuntime.getStreamRuntime();
for (int i = 0; i < queryRuntime.getInputStreamId().size(); i++) {
if ((streamRuntime.getSingleStreamRuntimes().get(i)).getProcessStreamReceiver().getStreamId().equals
(streamId + key)) {
streamJunction.subscribe((streamRuntime.getSingleStreamRuntimes().get(i))
.getProcessStreamReceiver());
}
}
}
}
示例3: PartitionRuntime
import org.wso2.siddhi.core.stream.StreamJunction; //导入依赖的package包/类
public PartitionRuntime(ConcurrentMap<String, AbstractDefinition> streamDefinitionMap, ConcurrentMap<String,
StreamJunction> streamJunctionMap, Partition partition, SiddhiAppContext siddhiAppContext) {
this.siddhiAppContext = siddhiAppContext;
if (partition.getPartitionTypeMap().isEmpty()) {
throw new SiddhiAppCreationException("Partition must have at least one executor. But found none.");
}
try {
Element element = AnnotationHelper.getAnnotationElement("info", "name",
partition.getAnnotations());
if (element != null) {
this.partitionId = element.getValue();
}
} catch (DuplicateAnnotationException e) {
throw new DuplicateAnnotationException(e.getMessageWithOutContext() + " for the same Query " +
partition.toString(), e, e.getQueryContextStartIndex(), e.getQueryContextEndIndex(),
siddhiAppContext.getName(), siddhiAppContext.getSiddhiAppString());
}
if (partitionId == null) {
this.partitionId = UUID.randomUUID().toString();
}
elementId = "PartitionRuntime-" + siddhiAppContext.getElementIdGenerator().createNewId();
this.partition = partition;
this.streamDefinitionMap = streamDefinitionMap;
this.streamJunctionMap = streamJunctionMap;
}
示例4: addEventTrigger
import org.wso2.siddhi.core.stream.StreamJunction; //导入依赖的package包/类
public static void addEventTrigger(TriggerDefinition triggerDefinition,
ConcurrentMap<String, Trigger> eventTriggerMap,
ConcurrentMap<String, StreamJunction> streamJunctionMap,
SiddhiAppContext siddhiAppContext) {
if (!eventTriggerMap.containsKey(triggerDefinition.getId())) {
Trigger trigger;
if (triggerDefinition.getAtEvery() != null) {
trigger = new PeriodicTrigger();
} else if (triggerDefinition.getAt().trim().equalsIgnoreCase(SiddhiConstants.TRIGGER_START)) {
trigger = new StartTrigger();
} else {
trigger = new CronTrigger();
}
StreamJunction streamJunction = streamJunctionMap.get(triggerDefinition.getId());
trigger.init(triggerDefinition, siddhiAppContext, streamJunction);
siddhiAppContext.addEternalReferencedHolder(trigger);
eventTriggerMap.putIfAbsent(trigger.getId(), trigger);
}
}
示例5: ObjectSizeCalculator
import org.wso2.siddhi.core.stream.StreamJunction; //导入依赖的package包/类
/**
* Creates an object size calculator that can calculate object sizes for a given
* {@code memoryLayoutSpecification}.
*
* @param memoryLayoutSpecification a description of the JVM memory layout.
*/
public ObjectSizeCalculator(MemoryLayoutSpecification memoryLayoutSpecification) {
Preconditions.checkNotNull(memoryLayoutSpecification);
arrayHeaderSize = memoryLayoutSpecification.getArrayHeaderSize();
objectHeaderSize = memoryLayoutSpecification.getObjectHeaderSize();
objectPadding = memoryLayoutSpecification.getObjectPadding();
referenceSize = memoryLayoutSpecification.getReferenceSize();
superclassFieldPadding = memoryLayoutSpecification.getSuperclassFieldPadding();
ignoreCalculation.add(SiddhiAppContext.class);
ignoreCalculation.add(StreamJunction.class);
ignoreCalculation.add(OutputCallback.class);
ignoreCalculation.add(StreamCallback.class);
ignoreCalculation.add(ThroughputTracker.class);
ignoreCalculation.add(LatencyTracker.class);
ignoreCalculation.add(MemoryUsageTracker.class);
ignoreCalculation.add(BufferedEventsTracker.class);
ignoreCalculation.add(StatisticsManager.class);
ignoreCalculation.add(MemoryCalculable.class);
ignoreCalculation.add(AbstractRecordTable.class);
}
示例6: clone
import org.wso2.siddhi.core.stream.StreamJunction; //导入依赖的package包/类
public QueryRuntime clone(String key, ConcurrentMap<String, StreamJunction> localStreamJunctionMap) {
StreamRuntime clonedStreamRuntime = this.streamRuntime.clone(key);
QuerySelector clonedSelector = this.selector.clone(key);
OutputRateLimiter clonedOutputRateLimiter = outputRateLimiter.clone(key);
QueryRuntime queryRuntime = new QueryRuntime(query,siddhiContext,clonedStreamRuntime,clonedSelector,clonedOutputRateLimiter,this.metaStateEvent);
queryRuntime.queryId = this.queryId + key;
queryRuntime.setToLocalStream(toLocalStream);
queryRuntime.setDefinitionMap(definitionMap);
if (!toLocalStream) {
queryRuntime.outputRateLimiter.setOutputCallback(outputCallback);
queryRuntime.outputCallback = this.outputCallback;
} else {
OutputCallback clonedQueryOutputCallback = OutputParser.constructOutputCallback(query.getOutputStream(), key, localStreamJunctionMap, outputStreamDefinition, siddhiContext);
queryRuntime.outputRateLimiter.setOutputCallback(clonedQueryOutputCallback);
queryRuntime.outputCallback = clonedQueryOutputCallback;
}
return queryRuntime;
}
示例7: PartitionRuntime
import org.wso2.siddhi.core.stream.StreamJunction; //导入依赖的package包/类
public PartitionRuntime(ExecutionPlanRuntime executionPlanRuntime, Partition partition, ConcurrentMap<String, AbstractDefinition> streamDefinitionMap, ConcurrentMap<String, StreamJunction> streamJunctionMap, ConcurrentMap<String, InputHandler> inputHandlerMap, SiddhiContext siddhiContext) {
try {
Element element = AnnotationHelper.getAnnotationElement("info", "name", partition.getAnnotations());
if (element != null) {
this.partitionId = element.getValue();
}
} catch (DuplicateAnnotationException e) {
throw new QueryCreationException(e.getMessage() + " for the same Query " + partition.toString());
}
if (partitionId == null) {
this.partitionId = UUID.randomUUID().toString();
}
this.streamDefinitionMap = streamDefinitionMap;
this.streamJunctionMap = streamJunctionMap;
this.inputHandlerMap = inputHandlerMap;
this.partition = partition;
this.executionPlanRuntime = executionPlanRuntime;
this.siddhiContext = siddhiContext;
for (Query query : partition.getQueryList()) {
addQuery(query);
}
}
示例8: removePartition
import org.wso2.siddhi.core.stream.StreamJunction; //导入依赖的package包/类
public void removePartition(ConcurrentMap<String,StreamJunction> streamJunctionMap, ConcurrentMap<String,AbstractDefinition> streamDefinitionMap) {
for(PartitionInstanceRuntime partitionInstanceRuntime :partitionInstanceRuntimeMap.values()){
partitionInstanceRuntime.remove(streamJunctionMap,streamDefinitionMap);
}
for(String streamId:localStreamJunctionMap.keySet()){
localStreamJunctionMap.get(streamId).removeEventFlows();
}
localStreamDefinitionMap.clear();
localStreamJunctionMap.clear();
for (HandlerProcessor queryStreamProcessor : handlerProcessors) {
StreamJunction junction = streamJunctionMap.get(queryStreamProcessor.getStreamId());
if (junction != null) {
junction.removeEventFlow(queryStreamProcessor);
}
}
}
示例9: removeQuery
import org.wso2.siddhi.core.stream.StreamJunction; //导入依赖的package包/类
public void removeQuery(ConcurrentMap<String, StreamJunction> streamJunctionMap,
ConcurrentMap<String, AbstractDefinition> streamTableDefinitionMap) {
for (HandlerProcessor queryStreamProcessor : handlerProcessors) {
StreamJunction junction = streamJunctionMap.get(queryStreamProcessor.getStreamId());
if (junction != null) {
junction.removeEventFlow(queryStreamProcessor);
}
}
streamTableDefinitionMap.remove(query.getOutputStream().getStreamId());
}
示例10: constructQueryCreator
import org.wso2.siddhi.core.stream.StreamJunction; //导入依赖的package包/类
public static QueryCreator constructQueryCreator(String queryId, Query query, ConcurrentMap<String, AbstractDefinition> streamTableDefinitionMap, ConcurrentMap<String, StreamJunction> streamJunctionMap,
ConcurrentMap<String, EventTable> eventTableMap, OutputRateManager outputRateManager,
SiddhiContext siddhiContext) {
if (query.getInputStream() instanceof SingleStream) {
return new BasicQueryCreator(queryId, query, streamTableDefinitionMap, eventTableMap, outputRateManager, siddhiContext);
} else if (query.getInputStream() instanceof JoinStream) {
return new JoinQueryCreator(queryId, query, streamTableDefinitionMap, eventTableMap, outputRateManager, siddhiContext);
} else if (query.getInputStream() instanceof PatternStream) {
return new PatternQueryCreator(queryId, query, streamTableDefinitionMap, eventTableMap, outputRateManager, siddhiContext);
} else if (query.getInputStream() instanceof SequenceStream) {
return new SequenceQueryCreator(queryId, query, streamTableDefinitionMap, eventTableMap, outputRateManager, siddhiContext);
} else {
throw new QueryCreationException("Unsupported input stream found, " + query.getInputStream().getClass().getName());
}
}
示例11: InputManager
import org.wso2.siddhi.core.stream.StreamJunction; //导入依赖的package包/类
public InputManager(SiddhiAppContext siddhiAppContext,
ConcurrentMap<String, AbstractDefinition> streamDefinitionMap,
ConcurrentMap<String, StreamJunction> streamJunctionMap) {
this.streamJunctionMap = streamJunctionMap;
this.inputDistributor = new InputDistributor();
this.inputEntryValve = new InputEntryValve(siddhiAppContext, inputDistributor);
}
示例12: constructInputHandler
import org.wso2.siddhi.core.stream.StreamJunction; //导入依赖的package包/类
public InputHandler constructInputHandler(String streamId) {
InputHandler inputHandler = new InputHandler(streamId, inputHandlerMap.size(), inputEntryValve);
StreamJunction streamJunction = streamJunctionMap.get(streamId);
if (streamJunction == null) {
throw new DefinitionNotExistException("Stream with stream ID " + streamId + " has not been defined");
}
inputDistributor.addInputProcessor(streamJunctionMap.get(streamId).constructPublisher());
inputHandlerMap.put(streamId, inputHandler);
return inputHandler;
}
示例13: addCallback
import org.wso2.siddhi.core.stream.StreamJunction; //导入依赖的package包/类
public void addCallback(String streamId, StreamCallback streamCallback) {
streamCallback.setStreamId(streamId);
StreamJunction streamJunction = streamJunctionMap.get(streamId);
if (streamJunction == null) {
throw new DefinitionNotExistException("No stream found with name: " + streamId);
}
streamCallback.setStreamDefinition(streamDefinitionMap.get(streamId));
streamCallback.setContext(siddhiAppContext);
streamJunction.subscribe(streamCallback);
}
示例14: clone
import org.wso2.siddhi.core.stream.StreamJunction; //导入依赖的package包/类
public QueryRuntime clone(String key, ConcurrentMap<String, StreamJunction> localStreamJunctionMap) {
LockWrapper lockWrapper = null;
if (synchronised) {
lockWrapper = new LockWrapper("");
lockWrapper.setLock(new ReentrantLock());
}
StreamRuntime clonedStreamRuntime = this.streamRuntime.clone(key);
QuerySelector clonedSelector = this.selector.clone(key);
OutputRateLimiter clonedOutputRateLimiter = outputRateLimiter.clone(key);
clonedOutputRateLimiter.init(siddhiAppContext, lockWrapper, queryId);
QueryRuntime queryRuntime = new QueryRuntime(query, siddhiAppContext, clonedStreamRuntime, clonedSelector,
clonedOutputRateLimiter, outputCallback, this.metaComplexEvent,
synchronised, this.queryId + key);
QueryParserHelper.initStreamRuntime(clonedStreamRuntime, metaComplexEvent, lockWrapper, queryId);
queryRuntime.setToLocalStream(toLocalStream);
if (!toLocalStream) {
queryRuntime.outputRateLimiter.setOutputCallback(outputCallback);
queryRuntime.outputCallback = this.outputCallback;
} else {
OutputCallback clonedQueryOutputCallback = OutputParser.constructOutputCallback(query.getOutputStream(),
key,
localStreamJunctionMap,
outputStreamDefinition,
siddhiAppContext,
queryId);
queryRuntime.outputRateLimiter.setOutputCallback(clonedQueryOutputCallback);
queryRuntime.outputCallback = clonedQueryOutputCallback;
}
return queryRuntime;
}
示例15: addStreamJunction
import org.wso2.siddhi.core.stream.StreamJunction; //导入依赖的package包/类
public static void addStreamJunction(StreamDefinition streamDefinition,
ConcurrentMap<String, StreamJunction> streamJunctionMap,
SiddhiAppContext siddhiAppContext) {
if (!streamJunctionMap.containsKey(streamDefinition.getId())) {
StreamJunction streamJunction = new StreamJunction(streamDefinition,
siddhiAppContext.getExecutorService(),
siddhiAppContext.getBufferSize(), siddhiAppContext);
streamJunctionMap.putIfAbsent(streamDefinition.getId(), streamJunction);
}
}