Merge pull request #648 from OpenSkywalking/feature/close-graph-find-node
Close GraphNodeFinder#findNode
This commit is contained in:
commit
a9046ac018
|
|
@ -30,25 +30,6 @@ public class GraphNodeFinder {
|
|||
this.graph = graph;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find an exist node to build the graph.
|
||||
*
|
||||
* @param handlerId of specific node in graph.
|
||||
* @param outputClass of the found node
|
||||
* @param <NODEOUTPUT> type of given output class
|
||||
* @return Node instance.
|
||||
*/
|
||||
public <NODEOUTPUT> Node<?, NODEOUTPUT> findNode(int handlerId, Class<NODEOUTPUT> outputClass) {
|
||||
ConcurrentHashMap<Integer, Node> graphNodeIndex = graph.getNodeIndex();
|
||||
Node node = graphNodeIndex.get(handlerId);
|
||||
if (node == null) {
|
||||
throw new NodeNotFoundException("Can't find node with handlerId="
|
||||
+ handlerId
|
||||
+ " in graph[" + graph.getId() + "]");
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
public Next findNext(int handlerId) {
|
||||
ConcurrentHashMap<Integer, Node> graphNodeIndex = graph.getNodeIndex();
|
||||
Node node = graphNodeIndex.get(handlerId);
|
||||
|
|
|
|||
|
|
@ -105,15 +105,6 @@ public class GraphManagerTest {
|
|||
Next next = GraphManager.INSTANCE.findGraph(5).toFinder().findNext(3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindNode() {
|
||||
Graph<String> graph = GraphManager.INSTANCE.createIfAbsent(6, String.class);
|
||||
graph.addNode(new Node1Processor()).addNext(new Node2Processor());
|
||||
|
||||
Node<?, Integer> foundNode = GraphManager.INSTANCE.findGraph(6).toFinder().findNode(2, Integer.class);
|
||||
foundNode.addNext(new Node4Processor());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeadEndWay() {
|
||||
Graph<String> graph = GraphManager.INSTANCE.createIfAbsent(7, String.class);
|
||||
|
|
|
|||
Loading…
Reference in New Issue