-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jersey/Jetty, at least in the 3.1 version line, creates one thread for each HTTP request. This behavior was introduced with #5372 and seems not present in the 2.x or 3.x versions of Jersey. From the javadoc of `java.util.Timer`: ``` Implementation note: All constructors start a timer thread. ... After the last live reference to a Timer object goes away and all outstanding tasks have completed execution, the timer's task execution thread terminates gracefully (and becomes subject to garbage collection). However, this can take arbitrarily long to occur. ``` It is fair to assume that "arbitrarily long" may also mean _never_, in case GC never runs. This change replaces the timer & thread per request with a `ScheduledExecutorService` instance per `JettyHttpContainer`. Also changed the set-timeout mechanism to use `System.nanoTime()` instead of `System.currentTimeMillis()`, because the latter is prone to wall-clock drift and can result into wrong timeout values. Fixes #5588 Signed-off-by: Robert Stupp <[email protected]>
- Loading branch information
Showing
1 changed file
with
72 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters