Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Associate non-Ruby threads in ThreadService for JRUBY-3742: Java nati…

…ve threads are not added to ThreadService.rubyThreadMap after being adopted.
  • Loading branch information...
commit 3a3c8cd43442ed4d5f5a296c64d0400bd6e96fb1 1 parent 08c88f4
@headius headius authored
View
1  src/org/jruby/RubyThread.java
@@ -228,6 +228,7 @@ private static RubyThread adoptThread(final IRubyObject recv, Thread t, Block bl
rubyThread.threadImpl = new NativeThread(rubyThread, t);
ThreadContext context = runtime.getThreadService().registerNewThread(rubyThread);
+ runtime.getThreadService().associateThread(t, rubyThread);
context.preAdoptThread();
View
22 src/org/jruby/internal/runtime/ThreadService.java
@@ -38,7 +38,6 @@
import java.util.List;
import java.util.Map;
-import java.util.Hashtable;
import java.util.WeakHashMap;
import java.util.concurrent.Future;
import org.jruby.Ruby;
@@ -246,4 +245,25 @@ public synchronized void deliverEvent(Event event) {
// then deliver mail to the target
event.target.receiveMail(event);
}
+
+ /**
+ * Get the map from threadlike objects to RubyThread instances. Used mainly
+ * for testing purposes.
+ *
+ * @return The ruby thread map
+ */
+ public RubyThreadMap getRubyThreadMap() {
+ return rubyThreadMap;
+ }
+
+ /**
+ * Get the map from RubyThread objects to ThreadContext objects. Used for
+ * testing purposes.
+ *
+ * @return The thread context map
+ * @return
+ */
+ public Map getThreadContextMap() {
+ return threadContextMap;
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.