本文整理了Java中org.apache.edgent.graph.Graph.peekAll()
方法的一些代码示例,展示了Graph.peekAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.peekAll()
方法的具体详情如下:
包路径:org.apache.edgent.graph.Graph
类名称:Graph
方法名:peekAll
[英]Insert Peek oplets returned by the specified Supplier into the outputs of all of the oplets which satisfy the specified Predicate and where the output's Connector#isConnected()is true.
[中]将指定供应商返回的Peek Oplet插入满足指定谓词且输出的连接器#isConnected()为真的所有Oplet的输出中。
代码示例来源:origin: apache/incubator-edgent
/**
* Add counter metrics to all the topology's streams.
* <p>
* {@link CounterOp} oplets are inserted between every two graph
* vertices with the following exceptions:
* <ul>
* <li>Oplets are only inserted upstream from a FanOut oplet.</li>
* <li>If a chain of Peek oplets exists between oplets A and B, a Metric
* oplet is inserted after the last Peek, right upstream from oplet B.</li>
* <li>If a chain a Peek oplets is followed by a FanOut, a metric oplet is
* inserted between the last Peek and the FanOut oplet.</li>
* <li>Oplets are not inserted immediately downstream from another
* {@code CounterOp} oplet (but they are inserted upstream from one.)</li>
* </ul>
* The implementation is not idempotent: Calling the method twice
* will insert a new set of metric oplets into the graph.
* @param t
* The topology
* @see org.apache.edgent.graph.Graph#peekAll(org.apache.edgent.function.Supplier, org.apache.edgent.function.Predicate) Graph.peekAll()
*/
public static void counter(Topology t) {
// peekAll() embodies the above exclusion semantics
t.graph().peekAll(
() -> new CounterOp<>(),
v -> !(v.getInstance() instanceof CounterOp)
);
}
}
代码示例来源:origin: apache/incubator-edgent
t.graph().peekAll(
() -> { return new org.apache.edgent.streamscope.oplets.StreamScope<>(new StreamScope<>()); },
Functions.alwaysTrue());
内容来源于网络,如有侵权,请联系作者删除!