Some of the Jetty graceful shutdown tests were flaky due to the way
in which Jetty behaves when it is stopped.
Stopping the Jetty web server interrupts the thread that's handling
the active request. This initiates a race between the request-handling
thread which will decrement the number of active requests and the
main thread which expects an active request to cause the shutdown
result to be REQUESTS_ACTIVE. The test passes when the main thread
wins and fails as a request is active which it's checked. When the
request-handling thread wins the test fails as the count of active
requests has been deprecated before it is checked.
The blocking servlet that's used to stall a request and keep it
active needs to be updated to ignore the thread being interrupted
and continue waiting. This will ensure that a request remains active
until the main thread has checked the active request count and
determine the result of the shutdown.
Closes gh-27464
Previously, when the preferred json mapper was set to Gson, the Gson
HTTP message converter was added before any other converters. This
changed the form of String responses that were already valid. When
Jackson is in use, a string converter is used as it appears earlier
in the list than the Jackson converter. When the mapper is switched
to Gson, the Gson converter is added first in the list of converters
and the Strong converter is no longer used. This results in the
String, that was already valid JSON, being converted again. This
changes its form as quotes are escaped, etc.
This commit updates HttpMessageConverters so that the Gson converter
is added to the list immediately before the default Jackson
converter. This is done by considering the Gson converter to be an
equivalent of the Jackson converter.
Fixes gh-27354