diff --git a/p2p/src/main/java/bisq/network/p2p/mailbox/MailboxMessageService.java b/p2p/src/main/java/bisq/network/p2p/mailbox/MailboxMessageService.java index da9a7fb1ffd..de17f9e73ed 100644 --- a/p2p/src/main/java/bisq/network/p2p/mailbox/MailboxMessageService.java +++ b/p2p/src/main/java/bisq/network/p2p/mailbox/MailboxMessageService.java @@ -430,15 +430,21 @@ private void processSingleMailboxEntry(Collection // We run the batch processing of all mailbox messages we have received at startup in a thread to not block the UI. // For about 1000 messages decryption takes about 1 sec. private void threadedBatchProcessMailboxEntries(Collection protectedMailboxStorageEntries) { - ListeningExecutorService executor = Utilities.getSingleThreadListeningExecutor("processMailboxEntry-" + new Random().nextInt(1000)); long ts = System.currentTimeMillis(); - ListenableFuture> future = executor.submit(() -> { - var mailboxItems = getMailboxItems(protectedMailboxStorageEntries); - log.info("Batch processing of {} mailbox entries took {} ms", - protectedMailboxStorageEntries.size(), - System.currentTimeMillis() - ts); - return mailboxItems; - }); + SettableFuture> future = SettableFuture.create(); + + new Thread(() -> { + try { + var mailboxItems = getMailboxItems(protectedMailboxStorageEntries); + log.info("Batch processing of {} mailbox entries took {} ms", + protectedMailboxStorageEntries.size(), + System.currentTimeMillis() - ts); + future.set(mailboxItems); + + } catch (Throwable throwable) { + future.setException(throwable); + } + }, "processMailboxEntry-" + new Random().nextInt(1000)).start(); Futures.addCallback(future, new FutureCallback<>() { public void onSuccess(Set decryptedMailboxMessageWithEntries) {