mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-06-06 14:44:55 -04:00
Rework
This commit is contained in:
@@ -31,16 +31,14 @@ public abstract class BeaconInterface<T> {
|
||||
@SuppressWarnings("unchecked")
|
||||
@SneakyThrows
|
||||
public Class<T> getRequestClass() {
|
||||
var c = getClass().getSuperclass();
|
||||
var name = (c.getSuperclass().equals(BeaconInterface.class) ? c : getClass()).getName() + "$Request";
|
||||
var name = getClass().getName() + "$Request";
|
||||
return (Class<T>) Class.forName(name);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SneakyThrows
|
||||
public Class<T> getResponseClass() {
|
||||
var c = getClass().getSuperclass();
|
||||
var name = (c.getSuperclass().equals(BeaconInterface.class) ? c : getClass()).getName() + "$Response";
|
||||
var name = getClass().getName() + "$Response";
|
||||
return (Class<T>) Class.forName(name);
|
||||
}
|
||||
|
||||
@@ -83,10 +81,6 @@ public abstract class BeaconInterface<T> {
|
||||
.map(ServiceLoader.Provider::get)
|
||||
.map(beaconInterface -> (BeaconInterface<?>) beaconInterface)
|
||||
.collect(Collectors.toList());
|
||||
// Remove parent classes
|
||||
ALL.removeIf(beaconInterface -> ALL.stream()
|
||||
.anyMatch(other -> !other.equals(beaconInterface)
|
||||
&& beaconInterface.getClass().isAssignableFrom(other.getClass())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -69,49 +69,49 @@ public abstract class AppOperationMode {
|
||||
|
||||
private static void setup(String[] args) {
|
||||
try {
|
||||
// Only for handling SIGTERM
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
externalShutdown();
|
||||
}));
|
||||
if (AppProperties.get().isDaemon()) {
|
||||
// Only for handling SIGTERM
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
externalShutdown();
|
||||
}));
|
||||
|
||||
// Handle uncaught exceptions
|
||||
Thread.setDefaultUncaughtExceptionHandler((thread, ex) -> {
|
||||
// It seems like a few exceptions are thrown in the quantum renderer
|
||||
// when in shutdown. We can ignore these
|
||||
if (AppOperationMode.isInShutdown()
|
||||
&& Platform.isFxApplicationThread()
|
||||
&& ex instanceof NullPointerException) {
|
||||
return;
|
||||
}
|
||||
// Handle uncaught exceptions
|
||||
Thread.setDefaultUncaughtExceptionHandler((thread, ex) -> {
|
||||
// It seems like a few exceptions are thrown in the quantum renderer
|
||||
// when in shutdown. We can ignore these
|
||||
if (AppOperationMode.isInShutdown() && Platform.isFxApplicationThread() && ex instanceof NullPointerException) {
|
||||
return;
|
||||
}
|
||||
|
||||
// It seems like a few exceptions are thrown in the quantum renderer
|
||||
// when the screen configuration changes
|
||||
if (Platform.isFxApplicationThread()
|
||||
&& ex instanceof IllegalArgumentException
|
||||
&& ex.getStackTrace()[0].toString().contains("Rectangle2D")) {
|
||||
return;
|
||||
}
|
||||
// It seems like a few exceptions are thrown in the quantum renderer
|
||||
// when the screen configuration changes
|
||||
if (Platform.isFxApplicationThread() && ex instanceof IllegalArgumentException && ex.getStackTrace()[0].toString().contains(
|
||||
"Rectangle2D")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Some random AWT errors are thrown sometimes
|
||||
if (ex instanceof AWTError) {
|
||||
return;
|
||||
}
|
||||
// Some random AWT errors are thrown sometimes
|
||||
if (ex instanceof AWTError) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle any startup uncaught errors
|
||||
if (AppOperationMode.isInStartup() && thread.threadId() == 1) {
|
||||
ex.printStackTrace();
|
||||
AppOperationMode.halt(1);
|
||||
}
|
||||
// Handle any startup uncaught errors
|
||||
if (AppOperationMode.isInStartup() && thread.threadId() == 1) {
|
||||
ex.printStackTrace();
|
||||
AppOperationMode.halt(1);
|
||||
}
|
||||
|
||||
if (ex instanceof OutOfMemoryError) {
|
||||
ex.printStackTrace();
|
||||
AppOperationMode.halt(1);
|
||||
}
|
||||
if (ex instanceof OutOfMemoryError) {
|
||||
ex.printStackTrace();
|
||||
AppOperationMode.halt(1);
|
||||
}
|
||||
|
||||
ErrorEventFactory.fromThrowable(ex).unhandled(true).build().handle();
|
||||
});
|
||||
ErrorEventFactory.fromThrowable(ex).unhandled(true).build().handle();
|
||||
});
|
||||
}
|
||||
|
||||
AppProperties.init(args);
|
||||
|
||||
if (AppProperties.get().isCli()) {
|
||||
ModuleLayerLoader.loadAll(ModuleLayer.boot(), throwable -> throwable.printStackTrace());
|
||||
var cli = CliProvider.get();
|
||||
|
||||
14
dist/jpackage.gradle
vendored
14
dist/jpackage.gradle
vendored
@@ -81,12 +81,14 @@ jlink {
|
||||
jvmArgs = jpackageReleaseDaemonArguments
|
||||
}
|
||||
|
||||
secondaryLauncher {
|
||||
moduleName = packageName(null)
|
||||
mainClass = packageName('Main')
|
||||
name = "xpipe"
|
||||
jvmArgs = jpackageReleaseCliArguments
|
||||
winConsole = true
|
||||
if (os.isWindows()) {
|
||||
secondaryLauncher {
|
||||
moduleName = packageName(null)
|
||||
mainClass = packageName('Main')
|
||||
name = "xpipe"
|
||||
jvmArgs = jpackageReleaseCliArguments
|
||||
winConsole = true
|
||||
}
|
||||
}
|
||||
|
||||
jpackage {
|
||||
|
||||
Reference in New Issue
Block a user