How can I tell which part of the code hasn't terminated?

77 views Asked by At

I'm running the following code which is copied from the Siddhi samples. Upon reaching the last line of the code Eclipse indicates that something is still running. How can I tell what it is and shut it down?

Note that I'm more interested in general how to trace such a problem than in this specific case since the same has happened to me with other libraries.

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");
0

There are 0 answers