• Post Reply Bookmark Topic Watch Topic
  • New Topic

Question about Swingworker

 
Jarrod Rackley
Ranch Hand
Posts: 30
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recently wrote a network utility in Swing to assist in grabbing information about devices on our net.

Currently it reads in an excel file, those are very popular around here unfortunately, and grabs all the IP's/hostnames in question and starts gathering information.

It runs fine as is, but it takes quite some time if the lists are long. My question would SwingWorker be a good way of going about shortening the time it takes to
process by say starting multiple workers to go through smaller portions of the list simultaneously?

As it stands now it took it approximately 270 minutes to gather information about 2300 devices. Most lists I get would be about the same size as well.


Thank you for any suggestions or help offered.


-Jarrod

 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
grabs all the IP's/hostnames in question and starts gathering information


I assume you are gathering this information by accessing the internet.

If so, then yes, using multiple Threads will speed up the process. Your code will spend lots of time waiting for the replies from the internet accesses.

A SwingWorker is just a Thread that has an API that allows you to update Swing components on the EDT, so multiple SwingWorker should work fine and speed up the overall process. The only difference now is that the data may not be returned is sequential order so you may need to sort the results.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!