Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

threading taking loong time to process

807580Sep 2 2009 — edited Sep 5 2009
Hi Gurus,
I have a class which reads the file and send the record to separate classes to process that record. so:


|------ wclass1
|
|
|------ wclass2
|
|
mainclass |------ wclass3
|
|
|------ wclass4
|
|
|------ wclass5


so at the moment, mainclass calls wclass1.process(String record), wclass2.process(String record),... one after another.

I tried to make the wclass1,2..4 a Runnable and had a following loop in mainclass to check each wlcassx thread by updating a flag to see if the wclassx.process(String record) finished processing the current record so i can send the next record to process. But my threading didnt work.

while(true)
{
boolean recordProcessed = false;
for (int i = 0; i < tables.size(); i++)
{
recordProcessed = ((Extractor) tables.elementAt(i)).recordProcessed();
if(!recordProcessed)
{
break;
}
}
if(recordProcessed) break;
}

Please tell me the best to thread it.

Thanks a BUNCH
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 3 2009
Added on Sep 2 2009
31 comments
229 views