Previously, the worker used non-daemon threads which meant that they
prevented the JVM from shutting down. Ideally, we’d avoid this problem
by closing the worker and access log receiver as part of stopping
Undertow, however, due to an apparent bug in Undertow [1], it’s not
possible to do so cleanly.
This commit configures the access log worker to use daemon threads so
that they do not prevent the JVM from shutting down. Unfortunately,
this means that the threads will still be running after the context has
been closed but before the JVM shuts down but that appears to be
unavoidable due to the aforementioned Undertow bug.
Closes gh-4793
[1] https://issues.jboss.org/browse/UNDERTOW-597
Ensure that Collections.isEmpty() is used to check if there are no
elements in a collections. This is more explicit and can be faster than
calling .size().
Closes gh-4783
Update the documentation to include a section about ServletContext
initialization with embedded servlet containers. This update is to
primarily highlight that `WebApplicationInitializers` and Servlet 3.0+
`ServletContainerInitializers` are not called.
Fixes gh-4643
If the user provides their own ServerProperties bean we want to peek
at it to see if they set the port (and only that) when we are deciding
if the actuator context needs to be created. This happens very early
(in a @Condition) so we need to be very defensive. There are already
quite a few checks in place to prevent a ServerProperties bean from
being instantiated unless we really need it, and yet, when it is
we can do more.
This change creates the bean (and the ManagementProperties) in a
throwaway BeanFactory using the same BeanDefinition as the main
context. This ensures that when the main context bean is created
it will be in the "natural" order and binding to the Environment
can take place as normal.
Fixes gh-4631