• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Best practise for displaying live log files in swing

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys,

Ive come across a problem and Im not sure about the best way to proceed...

I need to display the progress of a large background process...I know the swing worker will allow me to update the UI live without threading issues...but Im un sure what component would be the best to use, mainly for overhead. My thinking is to use a JList and then append a new line to the end of a List Model...but Im not a hardcore Swing developer and was wondering if there is a preferred method of doing this? Below is a little more detail...

So are are going to be processing in the region fo 200,000 files and each one needs to be placed into the To Do list first off which needs to be displayed and then moved to the processed list once it has been completed. My thinking is that if we load everything into the to do list (JList) at the start then we can simply remove them and add them to the processed list (JList) once they have been completed...my worried lay around the ability of a JList to contain 200,000 records and then be modified live, will this cause the GUi to take loads of resources and the underlying process will need as much CPU as it can get to complete the job quickly....

Hope Ive made what Im trying to do clear any comments would be great as Im a bit of a novice when it comes to developing multi thread Swing apps...


Cheers in advance
Kris
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is what I see in your post...

Requirement 1:

I need to display the progress of a large background process


Requirement 2:

each one needs to be placed into the To Do list


Requirement 3:

then moved to the processed list once it has been completed



So, you are going to have 3 lists- one showing the ToDo, completed, and currently running process.

I would load the file names or whatever it is that needs to be displayed in the todo list 10 or 20 at a time and the same with the completed list. Depending on the file size and what kind of processing is going on, you may complete the background process before the list is ever populated (simulated race condition) at 200,000 lines. After processing 20 files or so I would save the completed list to a flat file, XML file or similar in case something happened to the app, that way you could have a reference to look up to determine the last file processed. This would prevent displaying 200,000 records in a list.

Think of it like a baseball game where you have players in the dugout (todo), players on the bases (completed), players on deck (currently run process) and the scoreboard as your record keeper.

Hope that helps.
 
I'm sure glad that he's gone. Now I can read this tiny ad in peace!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic