public final class UnresolvedControlThrowable extends Throwable
When suspending a call, the runtime uses the exception handling mechanism of the Java Virtual Machine to unravel the (Java) call stack and while doing so, to build a representation of the Lua call stack for a later resume. This throwable is an essential part of this mechanism.
An UnresolvedControlThrowable
contains an incomplete call stack, missing the
bottom-most call frame. In order to resolve the control throwable, a call frame must
be attached by calling the method resolve(Resumable, Object)
, and the resulting
ResolvedControlThrowable
must be thrown. When this process is repeated on every
level of the Lua call stack all the way down to the entry point, a full Lua call stack
representation will be built.
Consequently, this throwable should never be ignored. Doing so would prevent both the non-local control change (i.e., the suspend) and the construction of the Lua call stack.
Instances of this class are immutable and do not contain Java stack traces for performance reasons.
Modifier and Type | Method and Description |
---|---|
ResolvedControlThrowable |
resolve(Resumable resumable,
Object suspendedState)
Resolves this control throwable by prepending a call frame to it.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public ResolvedControlThrowable resolve(Resumable resumable, Object suspendedState)
ResolvedControlThrowable
must be thrown in order to continue
unravelling the call stack.
When resuming this call, the runtime will use resumable
as the function
object used to continue the execution, and supply it with the suspendedState
object (or an object equivalent to it, see Resumable
) registered
by this method.
resumable
- the resumable at this level, must not be null
suspendedState
- the suspended state, may be any valueNullPointerException
- if resumable
is null
Copyright © 2016. All rights reserved.