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.internal.le.jmod - Internal Line Editing Module
JDK 17 jdk.internal.le.jmod is the JMOD file for JDK 17 Internal Line Editing module.
JDK 17 Internal Line Editing module compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\jdk.internal.le.jmod.
JDK 17 Internal Line Editing module compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 Internal Line Editing module source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\jdk.internal.le.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/internal/org/jline/utils/Signals.java
/*
* Copyright (c) 2002-2020, the original author or authors.
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package jdk.internal.org.jline.utils;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Proxy;
import java.util.Objects;
/**
* Signals helpers.
*
* @author <a href="mailto:gnodet@gmail.com">Guillaume Nodet</a>
* @since 3.0
*/
public final class Signals {
private Signals() {
}
/**
*
* @param name the signal, CONT, STOP, etc...
* @param handler the callback to run
*
* @return an object that needs to be passed to the {@link #unregister(String, Object)}
* method to unregister the handler
*/
public static Object register(String name, Runnable handler) {
Objects.requireNonNull(handler);
return register(name, handler, handler.getClass().getClassLoader());
}
public static Object register(String name, final Runnable handler, ClassLoader loader) {
try {
Class<?> signalHandlerClass = Class.forName("sun.misc.SignalHandler");
// Implement signal handler
Object signalHandler = Proxy.newProxyInstance(loader,
new Class<?>[]{signalHandlerClass}, (proxy, method, args) -> {
// only method we are proxying is handle()
if (method.getDeclaringClass() == Object.class) {
if ("toString".equals(method.getName())) {
return handler.toString();
}
} else if (method.getDeclaringClass() == signalHandlerClass) {
Log.trace(() -> "Calling handler " + toString(handler) + " for signal " + name);
handler.run();
}
return null;
});
return doRegister(name, signalHandler);
} catch (Exception e) {
// Ignore this one too, if the above failed, the signal API is incompatible with what we're expecting
Log.debug("Error registering handler for signal ", name, e);
return null;
}
}
public static Object registerDefault(String name) {
try {
Class<?> signalHandlerClass = Class.forName("sun.misc.SignalHandler");
return doRegister(name, signalHandlerClass.getField("SIG_DFL").get(null));
} catch (Exception e) {
// Ignore this one too, if the above failed, the signal API is incompatible with what we're expecting
Log.debug("Error registering default handler for signal ", name, e);
return null;
}
}
public static void unregister(String name, Object previous) {
try {
// We should make sure the current signal is the one we registered
if (previous != null) {
doRegister(name, previous);
}
} catch (Exception e) {
// Ignore
Log.debug("Error unregistering handler for signal ", name, e);
}
}
private static Object doRegister(String name, Object handler) throws Exception {
Log.trace(() -> "Registering signal " + name + " with handler " + toString(handler));
Class<?> signalClass = Class.forName("sun.misc.Signal");
Constructor<?> constructor = signalClass.getConstructor(String.class);
Object signal;
try {
signal = constructor.newInstance(name);
} catch (InvocationTargetException e) {
if (e.getCause() instanceof IllegalArgumentException) {
Log.trace(() -> "Ignoring unsupported signal " + name);
} else {
Log.debug("Error registering handler for signal ", name, e);
}
return null;
}
Class<?> signalHandlerClass = Class.forName("sun.misc.SignalHandler");
return signalClass.getMethod("handle", signalClass, signalHandlerClass)
.invoke(null, signal, handler);
}
@SuppressWarnings("")
private static String toString(Object handler) {
try {
Class<?> signalHandlerClass = Class.forName("sun.misc.SignalHandler");
if (handler == signalHandlerClass.getField("SIG_DFL").get(null)) {
return "SIG_DFL";
}
if (handler == signalHandlerClass.getField("SIG_IGN").get(null)) {
return "SIG_IGN";
}
} catch (Throwable t) {
// ignore
}
return handler != null ? handler.toString() : "null";
}
}
⏎ jdk/internal/org/jline/utils/Signals.java
Or download all of them as a single archive file:
File name: jdk.internal.le-17.0.5-src.zip File size: 231458 bytes Release date: 2022-09-13 Download
⇒ JDK 17 jdk.internal.opt.jmod - Internal Opt Module
⇐ JDK 17 jdk.internal.jvmstat.jmod - Internal JVM Stat Module
2023-08-25, ≈18🔥, 0💬
Popular Posts:
What Is HttpComponents httpcore-4.4.6.jar? HttpComponents httpcore-4.4.6.jar is the JAR file for Apa...
JUnit Source Code Files are provided in the source package file, junit-4.13.2-sources.jar .You can b...
The JDT project provides the tool plug-ins that implement a Java IDE supporting the development of a...
The Web Services Description Language for Java Toolkit (WSDL4J), Release 1.6.2, allows the creation,...
What Is poi-ooxml-3.5.jar? poi-ooxml-3.5.jar is one of the JAR files for Apache POI 3.5, which provi...