XML processing and creating a resource in parallel in Java
I am writing a app, which has to create multiple Resources. The input is a XML. I need to parse the XML, create the Resources in parallel and update the responses in the Ouputs.
<Components>
<Resources>
<CreateResourceARequest> ...</CreateResourceARequest>
<CreateResourceBRequest>...</CreateResourceBRequest>
<CreateResourceCRequest>...</CreateResourceCRequest>
</Resources>
<Outputs>
<CreateResourceAResponse>...</CreateResourceAResponse>
<CreateResourceBResponse>...</CreateResourceBResponse>
<CreateResourceCResponse>...</CreateResourceCResponse>
</Outputs>
<Components>
Each of the ResourceRequests
are h开发者_如何学Pythonandled by a specific Classes.
What is the best way to create Resources in parallel, aggregate the results and update the xml ?
you will parse xml file in single thread anyway because the file is linear. but you can collect you parsers for each CreateResourceCRequest in a set and start them all in parallel threads after parsing file
精彩评论