本文整理了Java中org.apache.edgent.graph.Vertex.getInstance()
方法的一些代码示例,展示了Vertex.getInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vertex.getInstance()
方法的具体详情如下:
包路径:org.apache.edgent.graph.Vertex
类名称:Vertex
方法名:getInstance
[英]Get the instance of the oplet that will be executed.
[中]获取将要执行的oplet的实例。
代码示例来源:origin: org.apache.edgent/edgent-runtime-etiao
@SuppressWarnings({ "rawtypes", "unchecked" })
public VertexType(Vertex<? extends Oplet<?, ?>, ?, ?> value, IdMapper<String> ids) {
this.id = (value instanceof ExecutableVertex) ?
ids.add(value, ((ExecutableVertex) value).getInvocationId()) :
// Can't get an id from the vertex, generate unique value
ids.add(value);
this.invocation = new InvocationType(value.getInstance());
}
代码示例来源:origin: apache/incubator-edgent
@SuppressWarnings({ "rawtypes", "unchecked" })
public VertexType(Vertex<? extends Oplet<?, ?>, ?, ?> value, IdMapper<String> ids) {
this.id = (value instanceof ExecutableVertex) ?
ids.add(value, ((ExecutableVertex) value).getInvocationId()) :
// Can't get an id from the vertex, generate unique value
ids.add(value);
this.invocation = new InvocationType(value.getInstance());
}
代码示例来源: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
@Test
public void testMetricsEverywhere() throws Exception {
Topology t = newTopology();
TStream<String> s = t.strings("a", "b", "c");
// Condition inserts a sink
Condition<Long> tc = t.getTester().tupleCount(s, 3);
Graph g = t.graph();
Collection<Vertex<? extends Oplet<?, ?>, ?, ?>> vertices = g.getVertices();
// Two vertices before submission
assertEquals(2, vertices.size());
complete(t, tc);
// At least three vertices after submission
// (provide may have added other oplets as well)
Collection<Vertex<? extends Oplet<?, ?>, ?, ?>> verticesAfterSubmit = g.getVertices();
assertTrue("size="+verticesAfterSubmit.size(), verticesAfterSubmit.size() >= 3);
// There is exactly one vertex for a metric oplet
int numOplets = 0;
for (Vertex<? extends Oplet<?, ?>, ?, ?> v : verticesAfterSubmit) {
Oplet<?,?> oplet = v.getInstance();
if (oplet instanceof CounterOp) {
numOplets++;
}
}
assertEquals(1, numOplets);
}
代码示例来源:origin: apache/incubator-edgent
Oplet<?,?> oplet = v.getInstance();
if (oplet instanceof StreamScope) {
numOplets++;
代码示例来源:origin: apache/incubator-edgent
PeriodicSource<?> src = null;
for (Vertex<? extends Oplet<?, ?>, ?, ?> v : vertices) {
Oplet<?,?> op = v.getInstance();
assertTrue(op instanceof PeriodicSource);
src = (PeriodicSource<?>) op;
代码示例来源:origin: apache/incubator-edgent
assertSame(op, v.getInstance());
内容来源于网络,如有侵权,请联系作者删除!