1

We are calling web services to gather information for a graph with about 1500 nodes. We are displaying the graph in Prefuse while it continually is adding nodes and edges. Most of the time this seems to work great, but every once in awhile the entire app freezes, and the only way to recover is to kill the application and start over. No exceptions are printed out when this happens. On other occasions, I do fairly often see "IllegalArgumentException: Invalid row index: -1", but this doesn't seem to be associated with the freezing of the app.

I saw a related questions about freezing in applets, but our app is running in a JFrame, not an applet. Just in case this was our problem, we tried calling ActivityManager.stopThread() (could not find the kill method) in various places in our code. This doesn't seem to have much if any difference.

Is there a thread safe way for prefuse to display the graph while editing the graph?

Jay Askren
  • 10,282
  • 14
  • 53
  • 75
  • You probably need to show some code too. – Viruzzo Jan 16 '12 at 13:40
  • Did you try calling `kill()` as recommended in that thread? – Andrew Thompson Jan 16 '12 at 13:44
  • There is no longer a kill method. I'm only guessing it has been replaced by stopThread(). – Jay Askren Jan 16 '12 at 14:48
  • @Viruzzo Good point. I'll see if I can create a simple example that exhibits the same behavior. – Jay Askren Jan 16 '12 at 14:49
  • @AndrewThompson it still would be better to find why it freezes and make it exit cleanly; stopping threads from another is not very clean. – Viruzzo Jan 16 '12 at 14:51
  • For [`stopThread()`](http://prefuse.org/doc/api/prefuse/activity/ActivityManager.html#stopThread%28%29) the fine manual states *"Stops the activity manager thread. All scheduled actvities are canceled, and then the thread is then notified to stop running."* Sounds like a good way to stop the activity, and with no mention of [`Thread.stop()`](http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#stop%28%29). ;) What happened when you tired calling it? – Andrew Thompson Jan 16 '12 at 15:04
  • 1
    @JayAskren: You could try looking for EDT violation using one of the approaches cited [here](http://stackoverflow.com/q/7787998/230513). – trashgod May 30 '15 at 11:36
  • Thanks trashgod. That is a good point. I have moved on to other things since I asked this question, but checking for EDT violations would have been useful. – Jay Askren Aug 25 '15 at 23:02

1 Answers1

0

Is there a thread safe way to display the graph while editing the graph?

All updates to the GUI must be done on the EDT. Use a SwingWorker.

See Concurrency in Swing for more information.

camickr
  • 321,443
  • 19
  • 166
  • 288
  • 1
    Of course all updates to the gui must be on the EDT. That doesn't help at all with debugging prefuse though. – Jay Askren Jan 16 '12 at 17:50