-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(PUP-9931) Use ruby threadlocal implementation
If we cycle out JRuby instances while using the Java ThreadLocal class, we end up retaining references to the old JRuby instances. A simple solution to this is to use the native ruby ThreadLocalVar implementation, so that when a JRuby instance is GCd everything stored on the ruby Thread class will be collected as well.
- Loading branch information
Showing
2 changed files
with
11 additions
and
4 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'concurrent' | ||
|
||
# We want to use the pure Ruby implementation even on JRuby. If we use the Java | ||
# implementation of ThreadLocal, we end up leaking references to JRuby instances | ||
# and preventing them from being garbage collected. | ||
class Puppet::ThreadLocal < Concurrent::RubyThreadLocalVar | ||
end |