-
-
Notifications
You must be signed in to change notification settings - Fork 921
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test from JRUBY-1559, which has been fixed since Bill installed h…
…is ObjectProxyCache. git-svn-id: http://svn.codehaus.org/jruby/trunk/jruby@7544 961051c9-f516-0410-bf72-c9f7e237a7b7
- Loading branch information
Showing
3 changed files
with
43 additions
and
1 deletion.
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,23 @@ | ||
package org.jruby.test; | ||
|
||
public class Runner { | ||
|
||
private static Runner runner; | ||
public static Runner getRunner() { | ||
if (runner == null) { runner = new Runner(); } | ||
return runner; | ||
} | ||
|
||
private boolean running; | ||
|
||
public synchronized void runJob(Runnable r) { | ||
running = true; | ||
r.run(); | ||
running = false; | ||
} | ||
|
||
public boolean isRunning() { | ||
return running; | ||
} | ||
|
||
} |
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,18 @@ | ||
require 'test/unit' | ||
require 'java' | ||
|
||
class TestJavaWrapperDeadlock < Test::Unit::TestCase | ||
import org.jruby.test.Runner | ||
import java.lang.Runnable | ||
|
||
def test_deadlock_due_to_java_object_wrapping_locking_on_java_instances | ||
Runner.getRunner.runJob Runnable.impl { | ||
Thread.new do | ||
puts "geting runner instance" | ||
runner = Runner.getRunner | ||
puts "got runner instance" | ||
assert runner.isRunning, "runner should be running" | ||
end.join | ||
} | ||
end | ||
end |