Skip to content

Commit

Permalink
Configure worker for Undertow’s access log to use daemon threads
Browse files Browse the repository at this point in the history
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
  • Loading branch information
wilkinsona committed Dec 17, 2015
1 parent 408a302 commit b79ee14
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -405,8 +405,8 @@ private void createAccessLogDirectoryIfNecessary() {

private XnioWorker createWorker() throws IOException {
Xnio xnio = Xnio.getInstance(Undertow.class.getClassLoader());
OptionMap.Builder builder = OptionMap.builder();
return xnio.createWorker(builder.getMap());
return xnio.createWorker(
OptionMap.builder().set(Options.THREAD_DAEMON, true).getMap());
}

private void registerServletContainerInitializerToDriveServletContextInitializers(
Expand Down

0 comments on commit b79ee14

Please sign in to comment.