aspose file tools*
The moose likes Java in General and the fly likes application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "application "freezing"" Watch "application "freezing"" New topic
Author

application "freezing"

Agapios Hartzoulakis
Greenhorn

Joined: Oct 13, 2005
Posts: 17
Hi, here is my problem.
I'va made an application which reads a big amount of .txt files. This task takes a few minutes. The problem is that until this task is accomplished the application tottaly "freezes". Is there a way to avoid it?

The code goes like this:



Thanks in advance.
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
One possible solution is, to use a seperate thread that will take care of reading a file and do necessary tasks. The application is freezing because the same thread is used to control the GUI (or APP )and reads a big file.

HTH


Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Agapios Hartzoulakis
Greenhorn

Joined: Oct 13, 2005
Posts: 17
Could you give me a simple example of this?
Thanks
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
What you can do is create a new thread. In the run method of the thread read this big file.



If you need the contents of this file create an instance of Thread class with myFileReader's object, and run this thread.

If you need to know more on threads chect it here
Agapios Hartzoulakis
Greenhorn

Joined: Oct 13, 2005
Posts: 17
Thanks a lot. I could not expect anything more useful.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: application "freezing"