Please view the edits below
I\'m trying to create a JShell instance that gives me access to, and lets me interact with objects in the <
only speaking to a small part of this rather substantial question:
Additionally, exchanging DirectExecutionControl with LocalExecutionControl gives the same results, but I do not understand the difference between the two classes
LocalExecutionControl extends DirectExecutionControl and it overrides only invoke(Method method), the bodies of which are ...
local:
Thread snippetThread = new Thread(execThreadGroup, () -> {
...
res[0] = doitMethod.invoke(null, new Object[0]);
...
});
direct:
Object res = doitMethod.invoke(null, new Object[0]);
so the difference between the two classes is that direct invokes the method in the current thread, and local invokes it in a new thread. the same classloader is used in both cases, so you'd expect the same results in terms of sharing memory and loaded classes