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 17 jdk.jshell.jmod - JShell Tool
JDK 17 jdk.jshell.jmod is the JMOD file for JDK 17 JShell tool,
which can be invoked by the "jshell" command.
JDK 17 JShell tool compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\jdk.jshell.jmod.
JDK 17 JShell tool compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 JShell tool source code files are stored in \fyicenter\jdk-17.0.5\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", "removal"})
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-17.0.5-src.zip File size: 302589 bytes Release date: 2022-09-13 Download
⇒ JDK 17 jdk.jsobject.jmod - JS Object Module
2023-08-03, ≈23🔥, 0💬
Popular Posts:
io.jar is a component in iText Java library to provide input/output functionalities. iText Java libr...
What JAR files are required to run dom\Counter.java provided in the Apache Xerces package? You can f...
maven-compat-3.8.6.jar is the JAR file for Apache Maven 3.8.6 Compact module. The JAR file name may ...
JBrowser Source Code Files are provided in the source package file. You can download JBrowser source...
JDK 11 jdk.internal.le.jmod is the JMOD file for JDK 11 Internal Line Editing module. JDK 11 Interna...