From dfcd6260817a17881bc6f747678b6b59c49aa6c9 Mon Sep 17 00:00:00 2001 From: akwizgran Date: Fri, 5 Aug 2022 13:35:59 +0100 Subject: [PATCH] Add some logging to connectivity checks. --- .../mailbox/ContactMailboxConnectivityChecker.java | 9 +++++++++ .../bramble/mailbox/OwnMailboxConnectivityChecker.java | 1 + 2 files changed, 10 insertions(+) diff --git a/bramble-core/src/main/java/org/briarproject/bramble/mailbox/ContactMailboxConnectivityChecker.java b/bramble-core/src/main/java/org/briarproject/bramble/mailbox/ContactMailboxConnectivityChecker.java index 240f2c718..e29eb5e5c 100644 --- a/bramble-core/src/main/java/org/briarproject/bramble/mailbox/ContactMailboxConnectivityChecker.java +++ b/bramble-core/src/main/java/org/briarproject/bramble/mailbox/ContactMailboxConnectivityChecker.java @@ -5,13 +5,20 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault; import org.briarproject.bramble.api.system.Clock; import org.briarproject.bramble.mailbox.MailboxApi.ApiException; +import java.util.logging.Logger; + import javax.annotation.concurrent.ThreadSafe; import javax.inject.Inject; +import static java.util.logging.Logger.getLogger; + @ThreadSafe @NotNullByDefault class ContactMailboxConnectivityChecker extends ConnectivityCheckerImpl { + private static final Logger LOG = + getLogger(ContactMailboxConnectivityChecker.class.getName()); + private final MailboxApi mailboxApi; @Inject @@ -25,7 +32,9 @@ class ContactMailboxConnectivityChecker extends ConnectivityCheckerImpl { ApiCall createConnectivityCheckTask(MailboxProperties properties) { if (properties.isOwner()) throw new IllegalArgumentException(); return new SimpleApiCall(() -> { + LOG.info("Checking connectivity of contact's mailbox"); if (!mailboxApi.checkStatus(properties)) throw new ApiException(); + LOG.info("Contact's mailbox is reachable"); // Call the observers and cache the result onConnectivityCheckSucceeded(clock.currentTimeMillis()); }); diff --git a/bramble-core/src/main/java/org/briarproject/bramble/mailbox/OwnMailboxConnectivityChecker.java b/bramble-core/src/main/java/org/briarproject/bramble/mailbox/OwnMailboxConnectivityChecker.java index ddf73b1b5..1882cc5f4 100644 --- a/bramble-core/src/main/java/org/briarproject/bramble/mailbox/OwnMailboxConnectivityChecker.java +++ b/bramble-core/src/main/java/org/briarproject/bramble/mailbox/OwnMailboxConnectivityChecker.java @@ -59,6 +59,7 @@ class OwnMailboxConnectivityChecker extends ConnectivityCheckerImpl { private boolean checkConnectivityAndStoreResult( MailboxProperties properties) throws DbException { try { + LOG.info("Checking whether own mailbox is reachable"); List serverSupports = mailboxApi.getServerSupports(properties); LOG.info("Own mailbox is reachable");