Azure / azure-cosmosdb-java

Java Async SDK for SQL API of Azure Cosmos DB
MIT License
54 stars 61 forks source link

DocumentClientException is now thread-safe #323

Closed David-Noble-at-work closed 4 years ago

David-Noble-at-work commented 4 years ago

This PR eliminates a ConcurrentModificationException that is thrown when the DocumentClientException.requestHeaders and DocumentClientException.responseHeaders are modified on one thread while they are being enumerated on another thread. This may happen, for example, when DocumentClientException.toString is called on one thread while DocumentClientException.requestHeaders or DocumentClientException.responseHeaders are being updated on another.

This PR also:

See DocumentClientExceptionTest.canEnumerateWhileUpdatingHeaders.