Skip to content

Commit cba0cd6

Browse files
committed
Added Ref gem dependency on non-JRuby systems.
This commit is only viable because we create a JRuby-specific gem build. The conditional statement in the gemspec file is not processed at runtime. It is only processed when the gem is built. Therefore it *should* prevent the `Ref` gem from being installed when using the JRuby-specific build. This has not been tested, however.
1 parent 7d33d7e commit cba0cd6

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

concurrent-ruby.gemspec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@ Gem::Specification.new do |s|
3131
end
3232

3333
s.required_ruby_version = '>= 1.9.3'
34+
35+
unless defined?(JRUBY_VERSION)
36+
s.add_dependency 'ref', '~> 1.0.5'
37+
end
3438
end

lib/concurrent/atomic/thread_local_var.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ module ThreadLocalRubyStorage
88

99
protected
1010

11-
begin
11+
unless RUBY_PLATFORM == 'java'
1212
require 'ref'
13-
rescue LoadError
14-
raise LoadError,
15-
'ThreadLocalVar requires ref gem installed on MRI to avoid memory leaks. It\'s not concurrent-ruby dependency.'
1613
end
1714

1815
def allocate_storage

0 commit comments

Comments
 (0)