Implement jsonRpc command

Co-authored-by: technillogue <technillogue@gmail.com>

Closes #668
This commit is contained in:
AsamK 2021-08-09 17:42:01 +02:00
parent 6c00054407
commit a8bbdb54d0
20 changed files with 863 additions and 31 deletions

View file

@ -2028,6 +2028,9 @@ public class Manager implements Closeable {
try {
action.execute(this);
} catch (Throwable e) {
if (e instanceof AssertionError && e.getCause() instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
logger.warn("Message action failed.", e);
}
}
@ -2074,7 +2077,7 @@ public class Manager implements Closeable {
boolean returnOnTimeout,
boolean ignoreAttachments,
ReceiveMessageHandler handler
) throws IOException {
) throws IOException, InterruptedException {
retryFailedReceivedMessages(handler, ignoreAttachments);
Set<HandleAction> queuedActions = null;
@ -2110,6 +2113,9 @@ public class Manager implements Closeable {
try {
action.execute(this);
} catch (Throwable e) {
if (e instanceof AssertionError && e.getCause() instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
logger.warn("Message action failed.", e);
}
}
@ -2120,6 +2126,12 @@ public class Manager implements Closeable {
// Continue to wait another timeout for new messages
continue;
}
} catch (AssertionError e) {
if (e.getCause() instanceof InterruptedException) {
throw (InterruptedException) e.getCause();
} else {
throw e;
}
} catch (TimeoutException e) {
if (returnOnTimeout) return;
continue;
@ -2153,6 +2165,9 @@ public class Manager implements Closeable {
try {
action.execute(this);
} catch (Throwable e) {
if (e instanceof AssertionError && e.getCause() instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
logger.warn("Message action failed.", e);
}
}
@ -2549,6 +2564,9 @@ public class Manager implements Closeable {
avatarStore.storeProfileAvatar(address,
outputStream -> retrieveProfileAvatar(avatarPath, profileKey, outputStream));
} catch (Throwable e) {
if (e instanceof AssertionError && e.getCause() instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
logger.warn("Failed to download profile avatar, ignoring: {}", e.getMessage());
}
}