Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 25th, 2009, 09:00 PM
harryp harryp is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 1 harryp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 46 sec
Reputation Power: 0
Multithreading in JAVA

Hi All,
I am writing a program which will read list of customer from database and will create file for each customer. I want to do this using multi threading.
Say for example, there are 10 customer in database, i wish to run 4 threads to create file, once any thread is complete call anotehr thread to create file, till all files are created. At any point of time i wish to run only 4 threads.
Can anyone suggest me best way to do this in java? ia m ready multithreading in java and trying, but not sure how to keep track of number of threads running and starting new threads...
Please help...
Thanks..

Reply With Quote
  #2  
Old November 6th, 2009, 01:49 AM
Dharmayu P Dharmayu P is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 1 Dharmayu P User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 21 sec
Reputation Power: 0
Send a message via Yahoo to Dharmayu P Send a message via Google Talk to Dharmayu P
Multithreading for your Java application development

As you have already chose the Java for implementing multithreading so platform is no more the issue. Otherwise I would have been suggested you the .net platform to do so. As .net provides a special functionality as whenever any unused or suspended thread found it automatically load another thread from the memory. This could help you in tracking whether you file has been done with reading process or not.

Coming to your issue, being one of the Java Developers I can suggest you to make three threads, Reading, Writing and tracing. Also if u want to do something innovative to your application then use FILE Structure Implementation which is used in Unix Kernel process. You can make one data structure with three fields. Reading, Writing and Status code. This structure will eliminate the requirement of third thread. Whenever reading thread ends - it will make reading status code 1->0, when writing process will end it will also make code 1->0 in the structure and when both the field, say reading and writing field of data structure comes to 0 you can make the final status code o->1, showing that a complete process of reading and writing has been over. I have more detail idea on this, please check my profile and you can talk to me on msger.

Thank you.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > Multithreading in JAVA


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek