Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 11 jdk.jshell.jmod - JShell Tool
JDK 11 jdk.jshell.jmod is the JMOD file for JDK 11 JShell tool,
which can be invoked by the "jshell" command.
JDK 11 JShell tool compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.jshell.jmod.
JDK 11 JShell tool compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 JShell tool source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.jshell.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/jshell/execution/LocalExecutionControl.java
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package jdk.jshell.execution;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.concurrent.atomic.AtomicReference;
/**
* An implementation of {@link jdk.jshell.spi.ExecutionControl} which executes
* in the same JVM as the JShell-core.
*
* @author Grigory Ptashko
* @since 9
*/
public class LocalExecutionControl extends DirectExecutionControl {
private final Object STOP_LOCK = new Object();
private boolean userCodeRunning = false;
private ThreadGroup execThreadGroup;
/**
* Creates an instance, delegating loader operations to the specified
* delegate.
*
* @param loaderDelegate the delegate to handle loading classes
*/
public LocalExecutionControl(LoaderDelegate loaderDelegate) {
super(loaderDelegate);
}
/**
* Create an instance using the default class loading.
*/
public LocalExecutionControl() {
}
@Override
protected String invoke(Method doitMethod) throws Exception {
execThreadGroup = new ThreadGroup("JShell process local execution");
AtomicReference<InvocationTargetException> iteEx = new AtomicReference<>();
AtomicReference<IllegalAccessException> iaeEx = new AtomicReference<>();
AtomicReference<NoSuchMethodException> nmeEx = new AtomicReference<>();
AtomicReference<Boolean> stopped = new AtomicReference<>(false);
Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
if (e instanceof InvocationTargetException) {
if (e.getCause() instanceof ThreadDeath) {
stopped.set(true);
} else {
iteEx.set((InvocationTargetException) e);
}
} else if (e instanceof IllegalAccessException) {
iaeEx.set((IllegalAccessException) e);
} else if (e instanceof NoSuchMethodException) {
nmeEx.set((NoSuchMethodException) e);
} else if (e instanceof ThreadDeath) {
stopped.set(true);
}
});
final Object[] res = new Object[1];
Thread snippetThread = new Thread(execThreadGroup, () -> {
try {
res[0] = doitMethod.invoke(null, new Object[0]);
} catch (InvocationTargetException e) {
if (e.getCause() instanceof ThreadDeath) {
stopped.set(true);
} else {
iteEx.set(e);
}
} catch (IllegalAccessException e) {
iaeEx.set(e);
} catch (ThreadDeath e) {
stopped.set(true);
}
});
snippetThread.start();
Thread[] threadList = new Thread[execThreadGroup.activeCount()];
execThreadGroup.enumerate(threadList);
for (Thread thread : threadList) {
if (thread != null) {
thread.join();
}
}
if (stopped.get()) {
throw new StoppedException();
}
if (iteEx.get() != null) {
throw iteEx.get();
} else if (nmeEx.get() != null) {
throw nmeEx.get();
} else if (iaeEx.get() != null) {
throw iaeEx.get();
}
return valueString(res[0]);
}
@Override
@SuppressWarnings("deprecation")
public void stop() throws EngineTerminationException, InternalException {
synchronized (STOP_LOCK) {
if (!userCodeRunning) {
return;
}
if (execThreadGroup == null) {
throw new InternalException("Process-local code snippets thread group is null. Aborting stop.");
}
execThreadGroup.stop();
}
}
@Override
protected void clientCodeEnter() {
synchronized (STOP_LOCK) {
userCodeRunning = true;
}
}
@Override
protected void clientCodeLeave() {
synchronized (STOP_LOCK) {
userCodeRunning = false;
}
}
}
⏎ jdk/jshell/execution/LocalExecutionControl.java
Or download all of them as a single archive file:
File name: jdk.jshell-11.0.1-src.zip File size: 283093 bytes Release date: 2018-11-04 Download
⇒ JDK 11 jdk.jsobject.jmod - JS Object Module
2020-06-30, ≈56🔥, 0💬
Popular Posts:
JDK 11 jdk.internal.opt.jmod is the JMOD file for JDK 11 Internal Opt module. JDK 11 Internal Opt mo...
Apache Commons CLI Source Code Files are provided in the source package file commons-cli-1.5.0-sourc. ..
How to download and install JDK (Java Development Kit) 7? If you want to write Java applications, yo...
ANTLR is a powerful parser generator for multiple programming languages including Java. ANTLR contai...
What is jxl.jar 2.6.12? jxl.jar 2.6.12 is the JAR file for Java Excel API 2.6.12, which is a Java li...