docusign-esign-java-client icon indicating copy to clipboard operation
docusign-esign-java-client copied to clipboard

Thread Safety - either fix or document

Open newcron opened this issue 5 years ago • 2 comments

Hi Everyone,

I came to notice, that the current Java Client is not thread safe for a couple of reasons:

  • It uses classes that do not support concurrency and yield incorrect results when accessed by multiple threads like HashMap (explanation here)and SimpleDateFormat (explanation here)
  • The results of the last API call are stored in fields inside ApiClient (statusCode and responseHeaders) - which might be overridden by a concurrent request. Accessing that information from the outside may cause incorrect results

I understand that fixing these issues may introduce breaking changes (although using ThreadLocal might be a replacement for statusCode and responseHeader fields) and might not be something to be considered now.

However, I would ask you to at least document the concurrency based limitations of the API client and point out the best way to use the client in a concurrent setup, like a web application.

Thanks a lot

newcron avatar Oct 09 '19 08:10 newcron

Thank you, we have filed DCM-3629 to solve this problem and it is in high priority bucket.

LarryKlugerDS avatar Nov 02 '20 15:11 LarryKlugerDS