This week's book giveaway is in the Cloud forum.
We're giving away four copies of The Business Blockchain and have William Mougayar on-line!
See this thread for details.
Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Changing synchronous exection to asynchronous

 
praveen kanakarajan
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have an existing Application which is already running in production.I had a calss in weblayer which executes certain number of steps.Earlier all the execution was synchronous i.e it was calling a third party api and gettting the result.Now I have to call one more third party API via Socket/Webservice in the middle of execution.the new API will return result asynchronously.when it returns result,the remaining steps have to be executed.So the problem i am facing is how to keep the state of Objects till we get the asynchronous result and continue with the remaining steps.Is it ok if i keep the object in hashtable against a sequence number or any other better method is there?.Any Suggestions will be greatly helpful for me.
[ December 06, 2007: Message edited by: praveen kanakarajan ]
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about storing the state in the spawned task and when the task has finished, it gives the result as well as the state back to the processor.
This will make you save the hashtable lookup and stoarge and also the headache of generating a unique sequence number and that too in a thread-safe way.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic