From a1423b564279de6d59d2387ae8b0c32ea385bd12 Mon Sep 17 00:00:00 2001 From: wusheng Date: Sun, 5 Nov 2017 23:13:01 +0800 Subject: [PATCH] Finish graph APIs for streaming module. --- .../apm/collector/core/graph/Graph.java | 66 +++++++++++ .../collector/core/graph/GraphManager.java | 55 +++++++++ .../core/graph/GraphNotFoundException.java | 28 +++++ .../apm/collector/core}/graph/Next.java | 18 ++- .../apm/collector/core/graph/Node.java | 57 ++++++++++ .../collector/core/graph/NodeHandler.java} | 15 ++- .../core/graph/NodeNotFoundException.java | 28 +++++ .../graph/PotentialAcyclicGraphException.java | 28 +++++ .../core/graph/GraphManagerTest.java | 106 ++++++++++++++++++ .../collector/core/graph/Node1Handler.java} | 21 ++-- .../collector/core/graph/Node2Handler.java} | 28 ++--- .../collector/core/graph/Node3Handler.java | 34 ++++++ .../collector/core/graph/Node4Handler.java | 34 ++++++ 13 files changed, 474 insertions(+), 44 deletions(-) create mode 100644 apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/Graph.java create mode 100644 apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/GraphManager.java create mode 100644 apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/GraphNotFoundException.java rename apm-collector/{apm-collector-stream/collector-stream-define/src/main/java/org/skywalking/apm/collector/stream => apm-collector-core/src/main/java/org/skywalking/apm/collector/core}/graph/Next.java (74%) create mode 100644 apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/Node.java rename apm-collector/{apm-collector-stream/collector-stream-define/src/main/java/org/skywalking/apm/collector/stream/graph/Aggregator.java => apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/NodeHandler.java} (77%) create mode 100644 apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/NodeNotFoundException.java create mode 100644 apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/PotentialAcyclicGraphException.java create mode 100644 apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/GraphManagerTest.java rename apm-collector/{apm-collector-stream/collector-stream-define/src/main/java/org/skywalking/apm/collector/stream/graph/StreamGraph.java => apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/Node1Handler.java} (66%) rename apm-collector/{apm-collector-stream/collector-stream-define/src/main/java/org/skywalking/apm/collector/stream/graph/Node.java => apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/Node2Handler.java} (55%) create mode 100644 apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/Node3Handler.java create mode 100644 apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/Node4Handler.java diff --git a/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/Graph.java b/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/Graph.java new file mode 100644 index 0000000000..8c1f88251d --- /dev/null +++ b/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/Graph.java @@ -0,0 +1,66 @@ +/* + * Copyright 2017, OpenSkywalking Organization All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Project repository: https://github.com/OpenSkywalking/skywalking + */ + +package org.skywalking.apm.collector.core.graph; + +import java.util.concurrent.ConcurrentHashMap; + +/** + * @author peng-yongsheng, wu-sheng + */ +public final class Graph { + private int id; + private Node startNode; + private ConcurrentHashMap nodeIndex = new ConcurrentHashMap<>(); + + Graph(int id) { + this.id = id; + } + + public void start(Input input) { + startNode.execute(input); + } + + public Node addNode(NodeHandler nodeHandler) { + synchronized (this) { + startNode = new Node(this, nodeHandler); + return startNode; + } + } + + public Next findNext(int handlerId) { + Node node = nodeIndex.get(handlerId); + if (node == null) { + throw new NodeNotFoundException("Can't find node with handlerId=" + + handlerId + + " in graph[" + id + "】"); + } + return node.getNext(); + } + + void checkForNewNode(Node node) { + int nodeId = node.getHandler().id(); + if (nodeIndex.containsKey(nodeId)) { + throw new PotentialAcyclicGraphException("handler=" + + node.getHandler().getClass().getName() + + " already exists in graph[" + id + "】"); + } + nodeIndex.put(nodeId, node); + } + +} diff --git a/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/GraphManager.java b/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/GraphManager.java new file mode 100644 index 0000000000..a77d9de9b6 --- /dev/null +++ b/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/GraphManager.java @@ -0,0 +1,55 @@ +/* + * Copyright 2017, OpenSkywalking Organization All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Project repository: https://github.com/OpenSkywalking/skywalking + */ + +package org.skywalking.apm.collector.core.graph; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author wusheng + */ +public enum GraphManager { + INSTANCE; + + private Map allGraphs = new HashMap<>(); + + /** + * Create a stream process graph. + * + * @param graphId represents a graph, which is used for finding it. + * @return + */ + public synchronized Graph createIfAbsent(int graphId, Class input) { + if (!allGraphs.containsKey(graphId)) { + Graph graph = new Graph(graphId); + allGraphs.put(graphId, graph); + return graph; + } else { + return allGraphs.get(graphId); + } + } + + public Graph findGraph(int graphId) { + Graph graph = allGraphs.get(graphId); + if (graph == null) { + throw new GraphNotFoundException("Graph id=" + graphId + " not found in this GraphManager"); + } + return graph; + } +} diff --git a/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/GraphNotFoundException.java b/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/GraphNotFoundException.java new file mode 100644 index 0000000000..032d010549 --- /dev/null +++ b/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/GraphNotFoundException.java @@ -0,0 +1,28 @@ +/* + * Copyright 2017, OpenSkywalking Organization All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Project repository: https://github.com/OpenSkywalking/skywalking + */ + +package org.skywalking.apm.collector.core.graph; + +/** + * @author wusheng + */ +public class GraphNotFoundException extends RuntimeException { + public GraphNotFoundException(String message) { + super(message); + } +} diff --git a/apm-collector/apm-collector-stream/collector-stream-define/src/main/java/org/skywalking/apm/collector/stream/graph/Next.java b/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/Next.java similarity index 74% rename from apm-collector/apm-collector-stream/collector-stream-define/src/main/java/org/skywalking/apm/collector/stream/graph/Next.java rename to apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/Next.java index 118baaabe3..a7f636a4fe 100644 --- a/apm-collector/apm-collector-stream/collector-stream-define/src/main/java/org/skywalking/apm/collector/stream/graph/Next.java +++ b/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/Next.java @@ -16,28 +16,34 @@ * Project repository: https://github.com/OpenSkywalking/skywalking */ -package org.skywalking.apm.collector.stream.graph; +package org.skywalking.apm.collector.core.graph; -import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; -import org.skywalking.apm.collector.core.data.Data; import org.skywalking.apm.collector.core.framework.Executor; /** - * @author peng-yongsheng + * The Next is a delegate object for the following {@link Node}. + * + * @author peng-yongsheng, wu-sheng */ -public class Next implements Executor { +public class Next implements Executor { private final List nextNodes; public Next() { - this.nextNodes = new ArrayList<>(); + this.nextNodes = new LinkedList<>(); } public final void addNext(Node node) { nextNodes.add(node); } + /** + * Drive to the next nodes + * + * @param input + */ @Override public void execute(Input input) { nextNodes.forEach(node -> node.execute(input)); } diff --git a/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/Node.java b/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/Node.java new file mode 100644 index 0000000000..8a947bb348 --- /dev/null +++ b/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/Node.java @@ -0,0 +1,57 @@ +/* + * Copyright 2017, OpenSkywalking Organization All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Project repository: https://github.com/OpenSkywalking/skywalking + */ + +package org.skywalking.apm.collector.core.graph; + +/** + * The Node in the graph with explicit Input and Output types. + * + * @author peng-yongsheng, wu-sheng + */ +public final class Node { + private final NodeHandler nodeHandler; + private final Next next; + private final Graph graph; + + Node(Graph graph, NodeHandler nodeHandler) { + this.graph = graph; + this.nodeHandler = nodeHandler; + this.next = new Next<>(); + this.graph.checkForNewNode(this); + } + + public final Node addNext(NodeHandler nodeHandler) { + synchronized (graph) { + Node node = new Node<>(graph, nodeHandler); + next.addNext(node); + return node; + } + } + + final void execute(Input input) { + nodeHandler.process(input, next); + } + + NodeHandler getHandler() { + return nodeHandler; + } + + Next getNext() { + return next; + } +} diff --git a/apm-collector/apm-collector-stream/collector-stream-define/src/main/java/org/skywalking/apm/collector/stream/graph/Aggregator.java b/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/NodeHandler.java similarity index 77% rename from apm-collector/apm-collector-stream/collector-stream-define/src/main/java/org/skywalking/apm/collector/stream/graph/Aggregator.java rename to apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/NodeHandler.java index ab10cb29d5..10b1d63fbf 100644 --- a/apm-collector/apm-collector-stream/collector-stream-define/src/main/java/org/skywalking/apm/collector/stream/graph/Aggregator.java +++ b/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/NodeHandler.java @@ -16,13 +16,18 @@ * Project repository: https://github.com/OpenSkywalking/skywalking */ -package org.skywalking.apm.collector.stream.graph; - -import org.skywalking.apm.collector.core.data.Data; +package org.skywalking.apm.collector.core.graph; /** - * @author peng-yongsheng + * @author peng-yongsheng, wu-sheng */ -public interface Aggregator { +public interface NodeHandler { + /** + * The unique id in the certain graph. + * + * @return id + */ + int id(); + void process(Input input, Next next); } diff --git a/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/NodeNotFoundException.java b/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/NodeNotFoundException.java new file mode 100644 index 0000000000..dc2a27a4ff --- /dev/null +++ b/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/NodeNotFoundException.java @@ -0,0 +1,28 @@ +/* + * Copyright 2017, OpenSkywalking Organization All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Project repository: https://github.com/OpenSkywalking/skywalking + */ + +package org.skywalking.apm.collector.core.graph; + +/** + * @author wusheng + */ +public class NodeNotFoundException extends RuntimeException { + public NodeNotFoundException(String message) { + super(message); + } +} diff --git a/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/PotentialAcyclicGraphException.java b/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/PotentialAcyclicGraphException.java new file mode 100644 index 0000000000..91d06790fa --- /dev/null +++ b/apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/graph/PotentialAcyclicGraphException.java @@ -0,0 +1,28 @@ +/* + * Copyright 2017, OpenSkywalking Organization All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Project repository: https://github.com/OpenSkywalking/skywalking + */ + +package org.skywalking.apm.collector.core.graph; + +/** + * @author wusheng + */ +public class PotentialAcyclicGraphException extends RuntimeException { + public PotentialAcyclicGraphException(String message) { + super(message); + } +} diff --git a/apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/GraphManagerTest.java b/apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/GraphManagerTest.java new file mode 100644 index 0000000000..11a13490e8 --- /dev/null +++ b/apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/GraphManagerTest.java @@ -0,0 +1,106 @@ +/* + * Copyright 2017, OpenSkywalking Organization All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Project repository: https://github.com/OpenSkywalking/skywalking + */ + +package org.skywalking.apm.collector.core.graph; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * @author wusheng + */ +public class GraphManagerTest { + private static PrintStream OUT_REF; + private ByteArrayOutputStream outputStream; + + @Before + public void initAndHoldOut() { + OUT_REF = System.out; + outputStream = new ByteArrayOutputStream(); + PrintStream testStream = new PrintStream(outputStream); + System.setOut(testStream); + } + + @After + public void reset() { + System.setOut(OUT_REF); + } + + @Test + public void testGraph() { + Graph testGraph = GraphManager.INSTANCE.createIfAbsent(1, String.class); + Node node = testGraph.addNode(new Node1Handler()); + Node node1 = node.addNext(new Node2Handler()); + testGraph.start("Input String"); + + String output = outputStream.toString(); + String expected = "Node1 process: s=Input String\n" + + "Node2 process: s=Input String\n"; + + Assert.assertEquals(expected, output); + } + + @Test + public void testGraphWithChainStyle() { + Graph graph = GraphManager.INSTANCE.createIfAbsent(2, String.class); + graph.addNode(new Node1Handler()).addNext(new Node2Handler()).addNext(new Node4Handler()); + + graph.start("Input String"); + + String output = outputStream.toString(); + String expected = "Node1 process: s=Input String\n" + + "Node2 process: s=Input String\n" + + "Node4 process: int=123\n"; + + Assert.assertEquals(expected, output); + } + + @Test(expected = PotentialAcyclicGraphException.class) + public void testPotentialAcyclicGraph() { + Graph testGraph = GraphManager.INSTANCE.createIfAbsent(3, String.class); + Node node = testGraph.addNode(new Node1Handler()); + node.addNext(new Node1Handler()); + } + + @Test + public void testContinueStream() { + Graph graph = GraphManager.INSTANCE.createIfAbsent(4, String.class); + graph.addNode(new Node1Handler()).addNext(new Node2Handler()).addNext(new Node4Handler()); + + Next next = GraphManager.INSTANCE.findGraph(4).findNext(2); + + next.execute(123); + String output = outputStream.toString(); + String expected = + "Node4 process: int=123\n"; + + Assert.assertEquals(expected, output); + } + + @Test(expected = NodeNotFoundException.class) + public void handlerNotFound() { + Graph graph = GraphManager.INSTANCE.createIfAbsent(5, String.class); + graph.addNode(new Node1Handler()).addNext(new Node2Handler()).addNext(new Node4Handler()); + + Next next = GraphManager.INSTANCE.findGraph(5).findNext(3); + } +} diff --git a/apm-collector/apm-collector-stream/collector-stream-define/src/main/java/org/skywalking/apm/collector/stream/graph/StreamGraph.java b/apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/Node1Handler.java similarity index 66% rename from apm-collector/apm-collector-stream/collector-stream-define/src/main/java/org/skywalking/apm/collector/stream/graph/StreamGraph.java rename to apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/Node1Handler.java index a9c3209c64..0a00d5a55e 100644 --- a/apm-collector/apm-collector-stream/collector-stream-define/src/main/java/org/skywalking/apm/collector/stream/graph/StreamGraph.java +++ b/apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/Node1Handler.java @@ -16,23 +16,18 @@ * Project repository: https://github.com/OpenSkywalking/skywalking */ -package org.skywalking.apm.collector.stream.graph; - -import org.skywalking.apm.collector.core.data.Data; +package org.skywalking.apm.collector.core.graph; /** - * @author peng-yongsheng + * @author wusheng */ -public class StreamGraph { - - private Node startNode; - - public void start(Data input) { - startNode.execute(input); +public class Node1Handler implements NodeHandler { + @Override public int id() { + return 1; } - public Node addNode(Aggregator aggregator) { - startNode = new Node(aggregator); - return startNode; + @Override public void process(String s, Next next) { + System.out.println("Node1 process: s=" + s); + next.execute(s); } } diff --git a/apm-collector/apm-collector-stream/collector-stream-define/src/main/java/org/skywalking/apm/collector/stream/graph/Node.java b/apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/Node2Handler.java similarity index 55% rename from apm-collector/apm-collector-stream/collector-stream-define/src/main/java/org/skywalking/apm/collector/stream/graph/Node.java rename to apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/Node2Handler.java index 148d20a051..75adafae25 100644 --- a/apm-collector/apm-collector-stream/collector-stream-define/src/main/java/org/skywalking/apm/collector/stream/graph/Node.java +++ b/apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/Node2Handler.java @@ -16,30 +16,18 @@ * Project repository: https://github.com/OpenSkywalking/skywalking */ -package org.skywalking.apm.collector.stream.graph; - -import org.skywalking.apm.collector.core.data.Data; +package org.skywalking.apm.collector.core.graph; /** - * @author peng-yongsheng + * @author wusheng */ -public class Node { - - private final Aggregator aggregator; - private final Next next; - - public Node(Aggregator aggregator) { - this.aggregator = aggregator; - this.next = new Next<>(); - } - - public final Node addNext(Aggregator aggregator) { - Node node = new Node(aggregator); - next.addNext(node); - return node; +public class Node2Handler implements NodeHandler { + @Override public int id() { + return 2; } - final void execute(Input input) { - aggregator.process(input, next); + @Override public void process(String s, Next next) { + System.out.println("Node2 process: s=" + s); + next.execute(123); } } diff --git a/apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/Node3Handler.java b/apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/Node3Handler.java new file mode 100644 index 0000000000..eb063a6101 --- /dev/null +++ b/apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/Node3Handler.java @@ -0,0 +1,34 @@ +/* + * Copyright 2017, OpenSkywalking Organization All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Project repository: https://github.com/OpenSkywalking/skywalking + */ + +package org.skywalking.apm.collector.core.graph; + +/** + * @author wusheng + */ +public class Node3Handler implements NodeHandler { + @Override public int id() { + return 3; + } + + @Override + public void process(Long aLong, Next next) { + System.out.println("Node3 process: long=" + aLong); + next.execute(aLong); + } +} diff --git a/apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/Node4Handler.java b/apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/Node4Handler.java new file mode 100644 index 0000000000..5bf7d4e0ef --- /dev/null +++ b/apm-collector/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/graph/Node4Handler.java @@ -0,0 +1,34 @@ +/* + * Copyright 2017, OpenSkywalking Organization All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Project repository: https://github.com/OpenSkywalking/skywalking + */ + +package org.skywalking.apm.collector.core.graph; + +/** + * @author wusheng + */ +public class Node4Handler implements NodeHandler { + @Override public int id() { + return 4; + } + + @Override + public void process(Integer in, Next next) { + System.out.println("Node4 process: int=" + in); + next.execute(new Long(in.intValue())); + } +} -- GitLab