Utility
This commit is contained in:
@@ -141,8 +141,7 @@ public final class Utility {
|
|||||||
Function<String, ThreadFactory> virtualThreadFactoryFunction0 = null;
|
Function<String, ThreadFactory> virtualThreadFactoryFunction0 = null;
|
||||||
|
|
||||||
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||||
{ // Jdk21Inners
|
try { // Jdk21Inners
|
||||||
try {
|
|
||||||
String virtualName = "org.redkale.util.Jdk21Inners";
|
String virtualName = "org.redkale.util.Jdk21Inners";
|
||||||
Class virtualClazz = loader.loadClass(virtualName);
|
Class virtualClazz = loader.loadClass(virtualName);
|
||||||
Method method = virtualClazz.getMethod("createExecutor");
|
Method method = virtualClazz.getMethod("createExecutor");
|
||||||
@@ -163,9 +162,8 @@ public final class Utility {
|
|||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
{ // String-LATIN1
|
// String-LATIN1
|
||||||
MethodHandles.Lookup lookup = defaultLookup;
|
MethodHandles.Lookup lookup = defaultLookup;
|
||||||
VarHandle compactHandle = lookup.findStaticVarHandle(String.class, "COMPACT_STRINGS", boolean.class);
|
VarHandle compactHandle = lookup.findStaticVarHandle(String.class, "COMPACT_STRINGS", boolean.class);
|
||||||
final boolean compact = (Boolean) compactHandle.get(null);
|
final boolean compact = (Boolean) compactHandle.get(null);
|
||||||
@@ -174,8 +172,8 @@ public final class Utility {
|
|||||||
// LATIN1:0 UTF16:1
|
// LATIN1:0 UTF16:1
|
||||||
strLatin1Function0 = compact ? (String t) -> (Byte) coderHandle.get(t) == 0 : (String t) -> false;
|
strLatin1Function0 = compact ? (String t) -> (Byte) coderHandle.get(t) == 0 : (String t) -> false;
|
||||||
strByteFunction0 = (String t) -> (byte[]) valueHandle.get(t);
|
strByteFunction0 = (String t) -> (byte[]) valueHandle.get(t);
|
||||||
}
|
|
||||||
{ // signalShutdown
|
// signalShutdown
|
||||||
Class<Consumer<Consumer<String>>> shutdownClazz1 = null;
|
Class<Consumer<Consumer<String>>> shutdownClazz1 = null;
|
||||||
try {
|
try {
|
||||||
shutdownClazz1 = (Class) loader.loadClass("org.redkale.util.SignalShutDown");
|
shutdownClazz1 = (Class) loader.loadClass("org.redkale.util.SignalShutDown");
|
||||||
@@ -194,7 +192,6 @@ public final class Utility {
|
|||||||
RedkaleClassLoader.putReflectionDeclaredConstructors(shutdownClazz1, shutdownClazz1.getName());
|
RedkaleClassLoader.putReflectionDeclaredConstructors(shutdownClazz1, shutdownClazz1.getName());
|
||||||
signalShutdownConsumer0 = shutdownClazz1.getConstructor().newInstance();
|
signalShutdownConsumer0 = shutdownClazz1.getConstructor().newInstance();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (Throwable e) { // 不会发生
|
} catch (Throwable e) { // 不会发生
|
||||||
// do nothing
|
// do nothing
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
Reference in New Issue
Block a user