The Source for Java Technology Collaboration

Home » java.net Forums » Performance » General Performance Discussion

Thread: program slows down after upgrade to 1.5.0?

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 5 - Last Post: Mar 17, 2006 1:37 PM by: sdo Threads: [ Previous | Next ]
ryoko

Posts: 2
program slows down after upgrade to 1.5.0?
Posted: Mar 7, 2006 11:15 PM
  Click to reply to this thread Reply

I recently upgraded to JDK 1.5.0 and this program I was working on suddenly slows down tremedously to the point where it just hangs. The strange thing is that it only happens at times; sometimes, when I run the program, it works perfectly fine, then the next time I run it, it just hangs when it loads and I can't even do anything with it. This never happens when I was using JDK 1.4.2

The program can be a bit of a resource hog; it parses XML documents and draws it as a graph, so it does slow down at times when I load a huge document (but never to the point where it just hangs). After the upgrade to 1.5.0, it even hangs when a small document is loaded. Swing is used for the interface.

Any idea/suggestion on why the program hangs occasionally after the upgrade to 1.5.0?

scholnicks

Posts: 5
Re: program slows down after upgrade to 1.5.0?
Posted: Mar 8, 2006 7:45 AM   in response to: ryoko
  Click to reply to this thread Reply

Check out
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6219959. It might shed some light on your problem.

timbell

Posts: 33
Re: program slows down after upgrade to 1.5.0?
Posted: Mar 8, 2006 12:35 PM   in response to: ryoko
  Click to reply to this thread Reply

Have you tried attaching jconsole to the application?

Start your app with "-Dcom.sun.management.jmxremote" added to the command line.

Then start jconsole. A connection dialog box should list your application.

For more information, take a look at:
Using JConsole to Monitor Applications
http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html

Hope this helps - please post a followup message when you learn more about what is happening.

For even more troubleshooting help, check these documents:

Troubleshooting Guide for J2SE 5.0
http://java.sun.com/j2se/1.5/pdf/jdk50_ts_guide.pdf

HPROF: A Heap/CPU Profiling Tool in J2SE 5.0
http://java.sun.com/developer/technicalArticles/Programming/HPROF.html

aberrant

Posts: 90
Re: program slows down after upgrade to 1.5.0?
Posted: Mar 8, 2006 1:01 PM   in response to: ryoko
  Click to reply to this thread Reply

Do you use buffered images to display the graph?

As of 1.5 all buffered images are now managed. (http://java.sun.com/j2se/1.5.0/docs/guide/2d/new_features.html)
I’ve run into slowdowns with code that generates buffered images rapidly. My images were being regenerated for no reason, so my fix was simple, YMMV.

ryoko

Posts: 2
Re: program slows down after upgrade to 1.5.0?
Posted: Mar 17, 2006 1:30 PM   in response to: ryoko
  Click to reply to this thread Reply

Well, I've checked it out using jconsole. Turns out it was a deadlock caused between a synchronized method and JComponent.reshape(), which is called by JScrollBar.setValue().

I did not personally write the class that has the synchronized method (it's a class that extends Panel), so I didn't want to touch that method if possible. Currently I just had the JScrollBar.setValue() commented out to bypass the problem.

Since JComponent.reshape() is deprecated in JDK 5, and I never had deadlock problems when running in 1.4.2, I'm assuming there's something up with calling the deprecated method. But since it's called by JScrollBar.setValue(), I don't know what I can do about it aside from not calling setValue() at all. Any suggestions? The program does seem to function fine with it commented out so it's not a major problem, but I would rather solve the problem instead of just bypassing it.

Thanks a lot for all the help!

sdo

Posts: 37
Re: program slows down after upgrade to 1.5.0?
Posted: Mar 17, 2006 1:37 PM   in response to: ryoko
  Click to reply to this thread Reply

Is the call to setValue() happening on the event processing thread? Swing isn't threadsafe, and calling setValue() (and other Swing methods) from threads other than the event processing thread is a good way to get deadlock.

Check out http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html
for a complete example.




 XML java.net RSS