Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

running two process concurrently and store it in separate objects  RSS feed

 
vinoth muthuswamy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to java Thread concept.i want to read two xml files concurrently by hitting both URLs(the xml files in the URL) and store it

in two different objects.After completion of the URL reading i need to hit another URL to reset the site.Can any one give me the sample

code.....


Thanks in advance,
 
Stephan van Hulst
Saloon Keeper
Posts: 7687
139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vinoth, welcome to CodeRanch.

You can use an ExecutorService to handle any amount of tasks that you want, and then wait until they are done before you continue. It would look roughly like this:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!