Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining a top-level/main run method overrides #2542

ajitgeorge opened this issue Jan 30, 2015 · 2 comments

Defining a top-level/main run method overrides #2542

ajitgeorge opened this issue Jan 30, 2015 · 2 comments


Copy link

at least in interop with java.lang.Thread, as the following code demonstrates:

def run 
  puts 'in def run'
  # super # invoking super allows the thread blocks to run 

latch =
t1 = { puts 'executing t1'; latch.count_down }
t2 = { puts 'executing t2'; latch.count_down }


success = latch.await(1, java.util.concurrent.TimeUnit::SECONDS) 
puts success ? 'succeeded' : 'failed'
exit (success ? 0 : 1)

I'm seeing this behavior on all JRuby 1.7 versions up to 1.7.18 as well as
1.6.8, using Oracle JDK 1.7.0_72.

The problem doesn't occur with Ruby threads, probably because no implicit Runnable is created.

Note that the test-unit gem defines run in such a way that only the first thread block never executes.

A workaround is to undef run right after requiring test-unit.

Copy link

Same issue on master (7951249)

Copy link

kares commented May 23, 2017

its no longer the case with JRuby 9K due generate interface methods being bound directly

@kares kares closed this as completed May 23, 2017
@kares kares added this to the Invalid or Duplicate milestone May 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants