Creating Chart and Threading

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Souma
Posts: 17
Joined: Sun Nov 20, 2005 4:02 am

Creating Chart and Threading

Post by Souma » Sun Feb 05, 2006 12:15 pm

My createChart class creates faster than processing queries (due to large database, query takes some time to return the processed result to createChart class) thus i get nullpointerexception most of the time...

Any help on this?

How do i implement threading in this case? Any sample on applying threading to create chart (not sample on threading pls... i got tonnes..)?

mhilpert
Posts: 497
Joined: Wed Apr 02, 2003 1:57 pm
Location: Germany

Post by mhilpert » Mon Feb 06, 2006 1:27 pm

Why do you get NullPointerExceptions? If you don't have data, it doesn't make sense to create the chart. So why did you split both in separate threads? If you have a good reason for this, you need to synchronize both, meaning: let chart wait until data is available.
Java 11, JFreeChart 1.0.15, JFreeSVG 4.0

Locked