File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Synchronized tablemodel issue

 
Mark Dary
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I have a very large application that processes 3 record sets (call them a,b,c); each contains from 0 to 100,000 record objects (these come from raw data, not a database), and these record sets arrive at various unknown intervals via different threads.

When the first record set (a) is complete I process it to extract various fields which are put into a Map of table records; when record set b is complete I extract some fields to add to the records already in the map; and then I do the same for record set c.

Once complete I show the (read only) table on screen. The whole process then repeats (for example after anything from a few milliseconds to 30 seconds later).

If the interval between displaying the current map (via the EDT) and processing the next set of records is long enough, everything is fine.

However if the interval decreases there is some kind of synchronization issue that I need help with.

In the example you may need to decrease the sleep time and/or increase the number of records.

Note that the error various, eg null pointer, array bounds exception, etc.

If anyone can help it would be greatly appreciated.



 
Mark Dary
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to be pain guys and girls, but this has been driving me nuts for a couple of days.

Could anyone please, please help with the post?

Thanks.

Mark.
 
K. Tsang
Bartender
Pie
Posts: 3225
12
Android Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Honestly your code is kind of long to digest. It will be better to identify the section you found problematic.
 
VarunKumar Mallisetty
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code does not follow this rule --> "Once a Swing component has been realized, all code that might affect or depend on the state of that component should be executed in the event-dispatching thread." Read this for more info.
 
Mark Dary
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

The original code I posted is a complete example (cut,past,compile) to show the problem, the real app has 5 packages with around 100 classes.

I have now changed it so all GUI work is in the EDT (I think) and it works fine.

The next part (I think I'm almost finished) is finding a good synchronization point.

In the original example the makeData() method simulates the raw data that can be received and processed, this can be executed concurrently, anything from 1 to several hundred times.

As I said I think I am almost finished, if anyone is interested I will post a complete example.

Cheers.

Mark.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic