0

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");
Johnny
  • 7,073
  • 9
  • 46
  • 72
  • Start VisualVM. Attach to the process. Take a thread dump. Profit. – Boris the Spider Jun 16 '15 at 16:09
  • Note that your IDE will also have the ability to attach to a running process and even to execute a process in debug more. This is more involved however and less "general". – Boris the Spider Jun 16 '15 at 16:10
  • I tried executing it in debug mode with Eclipse. The thread window says `SiddhiTest [Java Application] com.myproject.examples.SiddhiTest at localhost:39407 Thread [d94bfb16-cd5a-4f9f-bb32-a5df4fe31b43thread-0] (Running) Thread [DestroyJavaVM] (Running) /usr/lib/jvm/java-7-openjdk-amd64/bin/java (Jun 16, 2015, 7:19:10 PM) `. Is this the right place to look for the problem? – Johnny Jun 16 '15 at 16:21
  • Don't post additional information in the comments, add that to the question. Someone should be able to get all the need to answer the question from _the question_. Further, this isn't a thread dump, it's just a list of threads. – Boris the Spider Jun 16 '15 at 16:23

0 Answers0