-
June 21st, 2010, 08:26 AM
#1
Sax Parser Exception
I am creating many xml files and used thread class to create all the pages simultaneously but I am getting sax parser exception, so that pages are not created with required data. I am adding sample code here.
class PageThread extends Thread
{
Content content;
public createPageThread(Content content)
{
this.content = content;
}
public void run()
{
createPage(content);
}
}
This creatPage(Content) method has many methods.
I think when more than one thread try to access the same method that time we will get this error but I am not sure, If this is the case then what is the point of using threads?
Can anyone help me to solve this issue...
-
June 21st, 2010, 11:40 AM
#2
Re: Sax Parser Exception
Please use code tags when posting code.
Without the exception message and stack trace and the relevant code it's not possible to say what is going wrong.
If this is the case then what is the point of using threads?
The use of threads is often misunderstood and misapplied. If you want to parse 5 files, doing the task on 5 threads probably won't make it any faster and can even make it slower. Multi-threading tasks like this only helps if the processor is the bottle neck and you have multiple processors. If the bottleneck is reading from disk etc multiple threads will not help.
Where multiple threads help is when you have a time consuming task to perform but you don't want that task to stop other operations from working for example when you save a large file to disk if you don't want the GUI to freeze during the save operation you do the save on a separate thread.
-
June 21st, 2010, 01:09 PM
#3
Re: Sax Parser Exception
Could you post a link to this site's thread on the other site where you asked this question?
Norm
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|