Add some logging to connectivity checks.

This commit is contained in:
akwizgran
2022-08-05 13:35:59 +01:00
parent 347895f6b2
commit dfcd626081
2 changed files with 10 additions and 0 deletions

View File

@@ -5,13 +5,20 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import org.briarproject.bramble.api.system.Clock; import org.briarproject.bramble.api.system.Clock;
import org.briarproject.bramble.mailbox.MailboxApi.ApiException; import org.briarproject.bramble.mailbox.MailboxApi.ApiException;
import java.util.logging.Logger;
import javax.annotation.concurrent.ThreadSafe; import javax.annotation.concurrent.ThreadSafe;
import javax.inject.Inject; import javax.inject.Inject;
import static java.util.logging.Logger.getLogger;
@ThreadSafe @ThreadSafe
@NotNullByDefault @NotNullByDefault
class ContactMailboxConnectivityChecker extends ConnectivityCheckerImpl { class ContactMailboxConnectivityChecker extends ConnectivityCheckerImpl {
private static final Logger LOG =
getLogger(ContactMailboxConnectivityChecker.class.getName());
private final MailboxApi mailboxApi; private final MailboxApi mailboxApi;
@Inject @Inject
@@ -25,7 +32,9 @@ class ContactMailboxConnectivityChecker extends ConnectivityCheckerImpl {
ApiCall createConnectivityCheckTask(MailboxProperties properties) { ApiCall createConnectivityCheckTask(MailboxProperties properties) {
if (properties.isOwner()) throw new IllegalArgumentException(); if (properties.isOwner()) throw new IllegalArgumentException();
return new SimpleApiCall(() -> { return new SimpleApiCall(() -> {
LOG.info("Checking connectivity of contact's mailbox");
if (!mailboxApi.checkStatus(properties)) throw new ApiException(); if (!mailboxApi.checkStatus(properties)) throw new ApiException();
LOG.info("Contact's mailbox is reachable");
// Call the observers and cache the result // Call the observers and cache the result
onConnectivityCheckSucceeded(clock.currentTimeMillis()); onConnectivityCheckSucceeded(clock.currentTimeMillis());
}); });

View File

@@ -59,6 +59,7 @@ class OwnMailboxConnectivityChecker extends ConnectivityCheckerImpl {
private boolean checkConnectivityAndStoreResult( private boolean checkConnectivityAndStoreResult(
MailboxProperties properties) throws DbException { MailboxProperties properties) throws DbException {
try { try {
LOG.info("Checking whether own mailbox is reachable");
List<MailboxVersion> serverSupports = List<MailboxVersion> serverSupports =
mailboxApi.getServerSupports(properties); mailboxApi.getServerSupports(properties);
LOG.info("Own mailbox is reachable"); LOG.info("Own mailbox is reachable");