我正在运行以下代码,这些代码是从Siddhi样本中复制的。到达代码的最后一行时,Eclipse表示某些内容仍在运行。我该怎么知道它是什么并将其关闭?
请注意,我对如何追踪这样的问题比对这个特定情况更感兴趣,因为我和其他库一样。
SiddhiManager siddhiManager = new SiddhiManager();
String executionPlan = "@config(async = 'true')define stream cseEventStream (symbol string, price float, volume long);"
+ "@info(name = 'query1') from cseEventStream[volume < 150] select symbol,price insert into outputStream ;";
ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(executionPlan);
executionPlanRuntime.addCallback("query1", new QueryCallback() {
@Override
public void receive(long timeStamp, Event[] inEvents,
Event[] removeEvents) {
StringBuilder sb = new StringBuilder();
sb.append("Events{ @timeStamp = ").append(timeStamp).
append(", inEvents = ").append(Arrays.deepToString(inEvents)).
append(", RemoveEvents = ").append(Arrays.deepToString(removeEvents)).append(" }");
System.out.println(sb.toString());
}
});
executionPlanRuntime.start();
InputHandler inputHandler = executionPlanRuntime.getInputHandler("cseEventStream");
inputHandler.send(new Object[]{"IBM", 700f, 100l});
inputHandler.send(new Object[]{"WSO2", 60.5f, 200l});
inputHandler.send(new Object[]{"GOOG", 50f, 30l});
inputHandler.send(new Object[]{"IBM", 76.6f, 400l});
inputHandler.send(new Object[]{"WSO2", 45.6f, 50l});
System.out.println("Done feeding events");
Thread.sleep(500);
executionPlanRuntime.shutdown();
siddhiManager.shutdown();
System.out.println("Shutdown");