// We want to preserve the settings in the execution context
// which relate to tracing and breakpoints.
// Get the current execution context.
ExecutionContextImpl oldExecutionContext = getExecutionContext();
// Discard the FunctionRunThread. This holds the executor, execution
// context, etc.
runThread = null;
// Get a new execution context.
ExecutionContextImpl newExecutionContext = getExecutionContext();
// Update the new execution context with settings from the old one.
newExecutionContext.setBreakpoints(oldExecutionContext.getBreakpoints());
newExecutionContext.setTracedFunctions(oldExecutionContext.getTracedFunctions());
newExecutionContext.setTracingEnabled(oldExecutionContext.isTracingEnabled());
newExecutionContext.setTraceShowsFunctionArgs(oldExecutionContext.traceShowsFunctionArgs());
newExecutionContext.setTraceShowsThreadName(oldExecutionContext.traceShowsThreadName());
}