org.apache.edgent.graph.Graph.peekAll()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中org.apache.edgent.graph.Graph.peekAll()方法的一些代码示例,展示了Graph.peekAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.peekAll()方法的具体详情如下:
包路径:org.apache.edgent.graph.Graph
类名称:Graph
方法名:peekAll

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());

相关文章

微信公众号

最新文章

更多