Utility.inNativeImage

This commit is contained in:
redkale
2024-08-26 23:36:24 +08:00
parent 932bf729b0
commit 1d3049b743
3 changed files with 5 additions and 4 deletions

View File

@@ -41,8 +41,6 @@ public abstract class ClientConnection<R extends ClientRequest, P extends Client
protected final LongAdder doneResponseCounter = new LongAdder();
protected final AtomicBoolean writePending = new AtomicBoolean();
protected final ReentrantLock writeLock = new ReentrantLock();
protected final ByteArray writeArray = new ByteArray();
@@ -61,7 +59,6 @@ public abstract class ClientConnection<R extends ClientRequest, P extends Client
@Override
public void failed(Throwable exc, ClientConnection attachment) {
writePending.set(false);
attachment.dispose(exc);
}
};

View File

@@ -530,7 +530,7 @@ public abstract class Sncp {
}
newDynName += "_" + (normal ? name : hash(name));
}
if (methodBoost == null) { // 加强动态时不能重复加载
if (Utility.inNativeImage() || methodBoost == null) { // 加强动态时不能重复加载
try {
final String newDynClass = newDynName.replace('/', '.');
Class clz = RedkaleClassLoader.findDynClass(newDynClass);

View File

@@ -398,6 +398,10 @@ public final class Utility {
return CPUS;
}
public static boolean inNativeImage() {
return NATIVE_IMAGE_ENV;
}
public static Function<String, ExecutorService> virtualExecutorFunction() {
return virtualPoolFunction;
}