yeah you are right in terms of json structure but since the way it is, I cannot do much... I thought instead of worrying about all these details just make the code the way json it is so that it doesnt fail and return empty list if you cannot execute url for whatever reason. And that's what I did originally
hey saw the edit and I understood now.. So if I have to retry execute method say 3 times, how can I do that now since it throws RuntimeException now in the catch block so I might not be able to retry anymore? right? or I missed anything?
I also edited my question to add execute method which executes the URL.. Just to give you some idea how it looks like.. In my case, I am thinking to retry execute method few times if it throws exception. Because I want to get the data back at any cost by executing these url's. So for whatever reason first time, it gave IOException or Timedout for whatever reason, I can try calling execute method few times to make sure it give the response back.
hmmm so what I am supposed to do in PartialResultException constructor? Also I am not sure under what cases NoSuchElementException exception will be thrown. In my case, I can throw IOException since I am executing URL and that is what the exception can get thrown in that method.
Thanks for the great feedback. In my case, if for whatever reason, I am not able to parse response or execute URL properly, then I am returning empty List back. I guess that's ok in my use case here. Also to execute URL, I am using AsyncHttpClient which executes URL and return whole JSON response back as a String. And since executing URL can give some IOException or `TimeoutException', didn't got a response within a particular time, so that is why I return Optional<String> back as well.