synchronize sending requests
Hey what i m doing i have to send requests to yahoo for picking up the stock rates. The compan开发者_JAVA技巧ies name which i need to send are in an array n i have also coded to send only 100 companies request but what happens is the requests are sending all at a time and since it doesnt wait for the response i get response only for the first 100. how to synchronize sending requests?? Also is there sumthing like a lock which can be used to do it.??
you need to maintain a queue in which all request are inserted at once or in different time... Queue will fetch request execute it and remove it from queue after getting response. and this cycle continue till queue gets empty...
精彩评论