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:
tidies the DocumentClientException code,
makes all modifiable DocumentClientException fields volatile, and
adds a unit test to verify that no exceptions are thrown in the scenario this PR addresses.
See DocumentClientExceptionTest.canEnumerateWhileUpdatingHeaders.
This PR eliminates a
ConcurrentModificationException
that is thrown when theDocumentClientException.requestHeaders
andDocumentClientException.responseHeaders
are modified on one thread while they are being enumerated on another thread. This may happen, for example, whenDocumentClientException.toString
is called on one thread whileDocumentClientException.requestHeaders
orDocumentClientException.responseHeaders
are being updated on another.This PR also:
See
DocumentClientExceptionTest.canEnumerateWhileUpdatingHeaders
.