public final class ThreadContext extends Object
Modifier and Type | Field and Description |
---|---|
int |
callNumber |
boolean |
exceptionRequiresBacktrace |
IRubyObject |
nil |
Ruby |
runtime |
RuntimeCache |
runtimeCache |
SecureRandom |
secureRandom
Deprecated.
|
JavaSites |
sites |
public final Ruby runtime
public final IRubyObject nil
public final RuntimeCache runtimeCache
@Deprecated public transient SecureRandom secureRandom
getSecureRandom()
instead.public final JavaSites sites
public int callNumber
public boolean exceptionRequiresBacktrace
public static ThreadContext newContext(Ruby runtime)
public SecureRandom getSecureRandom()
protected void finalize() throws Throwable
public final Ruby getRuntime()
runtime
public IRubyObject getErrorInfo()
public IRubyObject setErrorInfo(IRubyObject errorInfo)
public Block.Type getCurrentBlockType()
public void setCurrentBlockType(Block.Type type)
public Throwable getSavedExceptionInLambda()
public void setSavedExceptionInLambda(Throwable e)
public CallType getLastCallType()
public Visibility getLastVisibility()
public void setLastCallStatusAndVisibility(CallType callType, Visibility visibility)
public IRubyObject getLastExitStatus()
public void setLastExitStatus(IRubyObject lastExitStatus)
public void printScope()
public DynamicScope getCurrentScope()
public StaticScope getCurrentStaticScope()
public void pushScope(DynamicScope scope)
public void popScope()
public RubyThread getThread()
public RubyThread getFiberCurrentThread()
public RubyDateFormatter getRubyDateFormatter()
public void setThread(RubyThread thread)
public ThreadFiber getFiber()
public void setFiber(ThreadFiber fiber)
public void setRootFiber(ThreadFiber rootFiber)
public void pushCatch(RubyContinuation.Continuation catchTarget)
public void popCatch()
public RubyContinuation.Continuation getActiveCatch(Object tag)
tag
- The interned string to search forpublic void pushEvalSimpleFrame(IRubyObject executeObject)
public void pushFrame()
public void popFrame()
public Frame getCurrentFrame()
public Frame getNextFrame()
public Frame getPreviousFrame()
public IRubyObject setBackRef(IRubyObject match)
match
- the value to setpublic IRubyObject getBackRef()
public IRubyObject setLastLine(IRubyObject last)
last
- the value to setpublic IRubyObject getLastLine()
public static void pushBacktrace(ThreadContext context, String method, String file, int line)
public static void popBacktrace(ThreadContext context)
public boolean hasAnyScopes()
public boolean scopeExistsOnCallStack(DynamicScope scope)
scope
- the static scope to look forpublic String getFrameName()
public IRubyObject getFrameSelf()
public RubyModule getFrameKlazz()
public Block getFrameBlock()
public String getFile()
public int getLine()
public void setLine(int line)
public void setFileAndLine(String file, int line)
public void setFileAndLine(ISourcePosition position)
public Visibility getCurrentVisibility()
public void setCurrentVisibility(Visibility visibility)
public void pollThreadEvents()
public int getCurrentTarget()
public void callThreadPoll()
public static void callThreadPoll(ThreadContext context)
public void trace(RubyEvent event, String name, RubyModule implClass)
public void trace(RubyEvent event, String name, RubyModule implClass, String file, int line)
@Deprecated public IRubyObject getConstant(String internedName)
public void renderCurrentBacktrace(StringBuilder sb)
sb
- the StringBuilder to which to render the backtracepublic IRubyObject createCallerBacktrace(int level, Integer length, StackTraceElement[] stacktrace)
level
- length
- public IRubyObject createCallerLocations(int level, Integer length, StackTraceElement[] stacktrace)
level
- the level at which the trace should startlength
- the length of the tracepublic RubyStackTraceElement[] createWarningBacktrace(Ruby runtime)
runtime
- public RubyStackTraceElement[] gatherCallerBacktrace()
public boolean isEventHooksEnabled()
public void setEventHooksEnabled(boolean flag)
@Deprecated public BacktraceElement[] createBacktrace2(int level, boolean nativeException)
public BacktraceElement[] getBacktrace()
public final BacktraceElement[] getBacktrace(int level)
public static String createRawBacktraceStringFromThrowable(Throwable ex, boolean color)
public void preAdoptThread()
public void preExtensionLoad(IRubyObject self)
public void preBsfApply(String[] names)
public void postBsfApply()
public void preMethodFrameAndScope(RubyModule clazz, String name, IRubyObject self, Block block, StaticScope staticScope)
public void preMethodFrameAndDummyScope(RubyModule clazz, String name, IRubyObject self, Block block, StaticScope staticScope)
public void preMethodNoFrameAndDummyScope(StaticScope staticScope)
public void postMethodFrameAndScope()
public void preMethodFrameOnly(RubyModule clazz, String name, IRubyObject self, Block block)
public void preMethodFrameOnly(RubyModule clazz, String name, IRubyObject self)
public void postMethodFrameOnly()
public void preMethodScopeOnly(StaticScope staticScope)
public void postMethodScopeOnly()
public void preMethodBacktraceAndScope(String name, StaticScope staticScope)
public void postMethodBacktraceAndScope()
public void preMethodBacktraceOnly(String name)
public void preMethodBacktraceDummyScope(String name, StaticScope staticScope)
public void postMethodBacktraceOnly()
public void postMethodBacktraceDummyScope()
public void prepareTopLevel(RubyClass objectClass, IRubyObject topSelf)
public void preNodeEval(IRubyObject self)
public void postNodeEval()
public void preExecuteUnder(IRubyObject executeUnderObj, RubyModule executeUnderClass, Block block)
public void postExecuteUnder()
public void preTrace()
public void postTrace()
public Frame preYieldSpecificBlock(Binding binding, StaticScope scope)
public void preEvalScriptlet(DynamicScope scope)
public void postEvalScriptlet()
public void postYieldNoScope(Frame lastFrame)
public void preScopedBody(DynamicScope scope)
public void postScopedBody()
public boolean isWithinTrace()
Ruby.callEventHooks(ThreadContext, RubyEvent, String, int, String, org.jruby.runtime.builtin.IRubyObject)
public void setWithinTrace(boolean isWithinTrace)
isWithinTrace
- true is soRuby.callEventHooks(ThreadContext, RubyEvent, String, int, String, org.jruby.runtime.builtin.IRubyObject)
public Binding currentBinding()
public Binding currentBinding(IRubyObject self)
self
- the self object to usepublic Binding currentBinding(IRubyObject self, Visibility visibility)
self
- the self object to usevisibility
- the visibility to usepublic Binding currentBinding(IRubyObject self, DynamicScope scope)
self
- the self object to usescope
- the scope to usepublic Binding currentBinding(IRubyObject self, Visibility visibility, DynamicScope scope)
self
- the self object to usevisibility
- the visibility to usescope
- the scope to usepublic ProfileCollection getProfileCollection()
public void startProfiling()
public void stopProfiling()
public boolean isProfiling()
public int profileEnter(int nextMethod)
public int profileEnter(String name, DynamicMethod nextMethod)
public int profileExit(int nextMethod, long startTime)
public Set<RecursiveComparator.Pair> getRecursiveSet()
public void setRecursiveSet(Set<RecursiveComparator.Pair> recursiveSet)
public void setExceptionRequiresBacktrace(boolean exceptionRequiresBacktrace)
public org.jcodings.Encoding[] encodingHolder()
@Deprecated public void setFile(String file)
@Deprecated public RubyDateFormat getRubyDateFormat()
Copyright © 2001-2016 JRuby. All Rights Reserved.