| Modifier and Type | Class and Description |
|---|---|
| public static class | ThreadService.
Deprecated
|
| Modifier and Type | Field and Description |
|---|---|
| private final ReentrantLock | |
| private ThreadContext | mainContext
A hard reference to the "main" context, so we always have one waiting for "main" thread execution. |
| private final ThreadGroup | rubyThreadGroup
The Java thread group into which we register all Ruby threads. |
| private final Map | rubyThreadMap
A map from a Java Thread to its RubyThread instance. |
| private final Ruby | |
| private final AtomicLong |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private RubyThread | |
| private static ThreadContext | |
| public void | |
| private static ThreadContext | |
| public void | |
| public void | |
| public synchronized void | |
| public RubyThread[] | |
| public boolean | |
| public final ThreadContext | Returns: The ThreadContext instance for the current thread, or a new one if none has previously been created or the old ThreadContext has been collected.In order to provide an appropriate execution context for a given thread, we store ThreadContext instances in a threadlocal. |
| public static ThreadContext | |
| public RubyThread | |
| public boolean | |
| public ThreadGroup | |
| public Map | |
| public ThreadContext | |
| public long | |
| public void | |
| public ThreadContext | |
| private void | |
| public void | |
| public final void | |
| public void | |
| public void | |
| public void | |
| public void | |
| private void |
| criticalLock | back to summary |
|---|---|
| private final ReentrantLock criticalLock | |
| mainContext | back to summary |
|---|---|
| private ThreadContext mainContext A hard reference to the "main" context, so we always have one waiting for "main" thread execution. | |
| rubyThreadGroup | back to summary |
|---|---|
| private final ThreadGroup rubyThreadGroup The Java thread group into which we register all Ruby threads. This is distinct from the RubyThreadGroup, which is simply a mutable collection of threads. | |
| rubyThreadMap | back to summary |
|---|---|
| private final Map<Thread, RubyThread> rubyThreadMap A map from a Java Thread to its RubyThread instance. This is a synchronized WeakHashMap, so it weakly references its keys; this means that when the Thread goes away, eventually its entry in this map will follow. | |
| runtime | back to summary |
|---|---|
| private final Ruby runtime | |
| threadCount | back to summary |
|---|---|
| private final AtomicLong threadCount | |
| ThreadService | back to summary |
|---|---|
| public ThreadService(final Ruby runtime) | |
| acquireCritical | back to summary |
|---|---|
| private void acquireCritical()
Deprecated
| |
| adoptCurrentThread | back to summary |
|---|---|
| private RubyThread adoptCurrentThread() | |
| adoptLoop | back to summary |
|---|---|
| private static ThreadContext adoptLoop(ThreadService service) | |
| associateThread | back to summary |
|---|---|
| public void associateThread(Thread thread, RubyThread rubyThread) | |
| contextFromAdopt | back to summary |
|---|---|
| private static ThreadContext contextFromAdopt(ThreadService service) | |
| deliverEvent | back to summary |
|---|---|
| public void deliverEvent(RubyThread sender, RubyThread target, ThreadService. Deprecated
| |
| disposeCurrentThread | back to summary |
|---|---|
| public void disposeCurrentThread()
Deprecated
| |
| dissociateThread | back to summary |
|---|---|
| public synchronized void dissociateThread(Object thread)
Deprecated
| |
| getActiveRubyThreads | back to summary |
|---|---|
| public RubyThread[] getActiveRubyThreads() | |
| getCritical | back to summary |
|---|---|
| public boolean getCritical()
Deprecated
| |
| getCurrentContext | back to summary |
|---|---|
| public final ThreadContext getCurrentContext() In order to provide an appropriate execution context for a given thread, we store ThreadContext instances in a threadlocal. This method is a utility to get at that threadlocal context from anywhere in the program it may not be immediately available. This method should be used sparingly, and if it is possible to pass ThreadContext on the argument list, it is preferable. Description of behavior The threadlocal does not actually contain the ThreadContext directly; instead, it contains a SoftReference that holds the ThreadContext. This is to allow new threads to enter the system and execute Ruby code with a valid context, but still allow that context to garbage collect if the thread stays alive much longer. We use SoftReference here because WeakReference is collected too quickly, resulting in very expensive ThreadContext churn (and this originally lead to JRUBY-2261's leak of adopted RubyThread instances).
| |
| getCurrentContext | back to summary |
|---|---|
| public static ThreadContext getCurrentContext(final ThreadService service) | |
| getMainThread | back to summary |
|---|---|
| public RubyThread getMainThread() | |
| getPolling | back to summary |
|---|---|
| public boolean getPolling()
Deprecated
| |
| getRubyThreadGroup | back to summary |
|---|---|
| public ThreadGroup getRubyThreadGroup()
Deprecated
| |
| getRubyThreadMap | back to summary |
|---|---|
| public Map Deprecated
| |
| getThreadContextForThread | back to summary |
|---|---|
| public ThreadContext getThreadContextForThread(RubyThread thread)
Deprecated
| |
| incrementAndGetThreadCount | back to summary |
|---|---|
| public long incrementAndGetThreadCount() | |
| initMainThread | back to summary |
|---|---|
| public void initMainThread() | |
| registerNewThread | back to summary |
|---|---|
| public ThreadContext registerNewThread(RubyThread thread) | |
| releaseCritical | back to summary |
|---|---|
| private void releaseCritical()
Deprecated
| |
| setCritical | back to summary |
|---|---|
| public void setCritical(boolean critical)
Deprecated
| |
| setCurrentContext | back to summary |
|---|---|
| public final void setCurrentContext(ThreadContext context)
Deprecated
| |
| setMainThread | back to summary |
|---|---|
| public void setMainThread(Thread thread, RubyThread rubyThread) | |
| teardown | back to summary |
|---|---|
| public void teardown() | |
| unregisterCurrentThread | back to summary |
|---|---|
| public void unregisterCurrentThread(ThreadContext context) | |
| unregisterThread | back to summary |
|---|---|
| public void unregisterThread(RubyThread thread) | |
| unregisterThreadImpl | back to summary |
|---|---|
| private void unregisterThreadImpl(ThreadContext context, Thread nativeThread) | |
Deprecated
| Modifier and Type | Class and Description |
|---|---|
| public static enum |
| Modifier and Type | Field and Description |
|---|---|
| public final String | |
| public final IRubyObject | |
| public final ThreadService. |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static ThreadService. | |
| public static ThreadService. | raise(RubyThread sender, RubyThread target, ThreadService.
Deprecated
|
| public String | |
| public static ThreadService. |
| description | back to summary |
|---|---|
| public final String description | |
| exception | back to summary |
|---|---|
| public final IRubyObject exception | |
| type | back to summary |
|---|---|
| public final ThreadService. | |
| Event | back to summary |
|---|---|
| public Event(String description, ThreadService. | |
| Event | back to summary |
|---|---|
| public Event(String description, ThreadService. | |
| kill | back to summary |
|---|---|
| public static ThreadService. Deprecated
| |
| raise | back to summary |
|---|---|
| public static ThreadService. Deprecated
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| wakeup | back to summary |
|---|---|
| public static ThreadService. Deprecated
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final ThreadService. | |
| public static final ThreadService. | |
| public static final ThreadService. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static ThreadService. | |
| public static ThreadService. |
| KILL | back to summary |
|---|---|
| public static final ThreadService. | |
| RAISE | back to summary |
|---|---|
| public static final ThreadService. | |
| WAKEUP | back to summary |
|---|---|
| public static final ThreadService. | |
| Type | back to summary |
|---|---|
| private Type() | |
| valueOf | back to summary |
|---|---|
| public static ThreadService. | |
| values | back to summary |
|---|---|
| public static ThreadService. | |