Permalink
Browse files

Add latest JRuby version with JDK-11

  • Loading branch information...
prashantvithani authored and pitr-ch committed Nov 15, 2018
1 parent 34f487b commit 5748952dcad13848706e1fd403a0100cccdd2ebe
Showing with 30 additions and 6 deletions.
  1. +5 −2 .travis.yml
  2. +11 −0 Rakefile
  3. +14 −4 spec/concurrent/synchronization_spec.rb
@@ -9,8 +9,11 @@ matrix:
include:
- name: MRI 2.5.1 Latest
rvm: 2.5.1
- name: JRuby 9.2.0.0 Latest
rvm: jruby-9.2.0.0
- name: JRuby 9.2.4.1 Latest on Java 11
rvm: jruby-9.2.4.1
jdk: oraclejdk11
- name: JRuby 9.2.4.1 Latest on Java 8
rvm: jruby-9.2.4.1
jdk: oraclejdk8
- name: TruffleRuby Latest
rvm: system
@@ -23,18 +23,29 @@ JRUBY_JAR_PATH = '/usr/local/opt/rbenv/versions/jruby-9.1.17.0/lib/jruby.jar'
class ConcurrentRubyJavaExtensionTask < Rake::JavaExtensionTask
def java_classpath_arg(*args)
jruby_cpath = nil

if RUBY_PLATFORM =~ /java/
begin
cpath = Java::java.lang.System.getProperty('java.class.path').split(File::PATH_SEPARATOR)
cpath += Java::java.lang.System.getProperty('sun.boot.class.path').split(File::PATH_SEPARATOR)
jruby_cpath = cpath.compact.join(File::PATH_SEPARATOR)
rescue => e
end

unless jruby_cpath
libdir = RbConfig::CONFIG['libdir']
if libdir.start_with? "classpath:"
raise 'Cannot build with jruby-complete'
end
jruby_cpath = File.join(libdir, "jruby.jar")
end
end

unless jruby_cpath
jruby_cpath = JRUBY_JAR_PATH
raise "#{jruby_cpath} does not exist" unless File.exist? jruby_cpath
end

jruby_cpath += File::PATH_SEPARATOR + args.join(File::PATH_SEPARATOR) unless args.empty?
jruby_cpath ? "-cp \"#{jruby_cpath}\"" : ""
end
@@ -181,10 +181,20 @@ def ns_initialize

specify 'final field always visible' do
store = BClass.new 'asd'
t1 = in_thread { 1000000000.times { |i| store = BClass.new i.to_s } }
t2 = in_thread { 10.times { expect(store.final).not_to be_nil; Thread.pass } }
t2.join
t1.kill
done = CountDownLatch.new
in_thread do
1000000000.times do |i|
store = BClass.new i.to_s
break if done.count == 0
end
end
in_thread do
10.times do
expect(store.final).not_to be_nil
Thread.pass
end
done.count_down
end
end

let(:store) { BClass.new }

0 comments on commit 5748952

Please sign in to comment.