File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Threads and Synchronization and the fly likes How to terminate the thread after particular task completed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "How to terminate the thread after particular task completed" Watch "How to terminate the thread after particular task completed" New topic
Author

How to terminate the thread after particular task completed

Balasubramaniam Muthusamy
Ranch Hand

Joined: Nov 30, 2010
Posts: 51
Hello,
is there any way terminate the thread after particular task completed or terminate other than all active threads?

Thanks
Bala
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42596
    
  65
What is "the thread"? A thread terminates automatically after its run method has finished.


Ping & DNS - my free Android networking tools app
Balasubramaniam Muthusamy
Ranch Hand

Joined: Nov 30, 2010
Posts: 51
Thanks much for your replies. As i said earlier i need to process the file which contains around 450 to 500 millions with 30 to 40 columns. Now these columns have to be encrypted using SHA-512. As of now we loop through entire flat file read the record by record and column by column. Now each column will be digested using SHA which return some 32 bytes and again some process using those bytes.
Finally record will be written to output file and the process will continue till last record.

Now I am trying to process the file using thread concept rather than one by one to improve the permonance.... What is the best way to process this file? is thread method will be helpful? any other better way? Please explain me... your help will be much appreciated

Thanks
Bala
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3737
    
  16
It depends. You first need to identify what is causing your performance problems. Is it
  • Reading the file
  • Decrypting the file
  • Processing the data
  • Writing the data to the output file.


  • Until you know where the problem is there is no point in trying to fix it. You also need to have benchmarks for each stage to know whether a change has had any effect. It's no good making multiple changes together as some of them may have a positive effect and others may have a negative effect.

    Joanne
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: How to terminate the thread after particular task completed