mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 22:59:54 +01:00
Add some logging.
This commit is contained in:
@@ -5,15 +5,22 @@ import org.briarproject.bramble.api.mailbox.MailboxFolderId;
|
|||||||
import org.briarproject.bramble.api.mailbox.MailboxProperties;
|
import org.briarproject.bramble.api.mailbox.MailboxProperties;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.annotation.concurrent.GuardedBy;
|
import javax.annotation.concurrent.GuardedBy;
|
||||||
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 ContactMailboxClient implements MailboxClient {
|
class ContactMailboxClient implements MailboxClient {
|
||||||
|
|
||||||
|
private static final Logger LOG =
|
||||||
|
getLogger(ContactMailboxClient.class.getName());
|
||||||
|
|
||||||
private final MailboxWorkerFactory workerFactory;
|
private final MailboxWorkerFactory workerFactory;
|
||||||
private final ConnectivityChecker connectivityChecker;
|
private final ConnectivityChecker connectivityChecker;
|
||||||
private final TorReachabilityMonitor reachabilityMonitor;
|
private final TorReachabilityMonitor reachabilityMonitor;
|
||||||
@@ -34,11 +41,13 @@ class ContactMailboxClient implements MailboxClient {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
|
LOG.info("Started");
|
||||||
// Nothing to do until contact is assigned
|
// Nothing to do until contact is assigned
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
|
LOG.info("Destroyed");
|
||||||
MailboxWorker uploadWorker, downloadWorker;
|
MailboxWorker uploadWorker, downloadWorker;
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
uploadWorker = this.uploadWorker;
|
uploadWorker = this.uploadWorker;
|
||||||
@@ -53,6 +62,7 @@ class ContactMailboxClient implements MailboxClient {
|
|||||||
@Override
|
@Override
|
||||||
public void assignContactForUpload(ContactId contactId,
|
public void assignContactForUpload(ContactId contactId,
|
||||||
MailboxProperties properties, MailboxFolderId folderId) {
|
MailboxProperties properties, MailboxFolderId folderId) {
|
||||||
|
LOG.info("Contact assigned for upload");
|
||||||
if (properties.isOwner()) throw new IllegalArgumentException();
|
if (properties.isOwner()) throw new IllegalArgumentException();
|
||||||
// For a contact's mailbox we should always be uploading to the outbox
|
// For a contact's mailbox we should always be uploading to the outbox
|
||||||
// assigned to us by the contact
|
// assigned to us by the contact
|
||||||
@@ -70,6 +80,7 @@ class ContactMailboxClient implements MailboxClient {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deassignContactForUpload(ContactId contactId) {
|
public void deassignContactForUpload(ContactId contactId) {
|
||||||
|
LOG.info("Contact deassigned for upload");
|
||||||
MailboxWorker uploadWorker;
|
MailboxWorker uploadWorker;
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
uploadWorker = this.uploadWorker;
|
uploadWorker = this.uploadWorker;
|
||||||
@@ -81,6 +92,7 @@ class ContactMailboxClient implements MailboxClient {
|
|||||||
@Override
|
@Override
|
||||||
public void assignContactForDownload(ContactId contactId,
|
public void assignContactForDownload(ContactId contactId,
|
||||||
MailboxProperties properties, MailboxFolderId folderId) {
|
MailboxProperties properties, MailboxFolderId folderId) {
|
||||||
|
LOG.info("Contact assigned for download");
|
||||||
if (properties.isOwner()) throw new IllegalArgumentException();
|
if (properties.isOwner()) throw new IllegalArgumentException();
|
||||||
// For a contact's mailbox we should always be downloading from the
|
// For a contact's mailbox we should always be downloading from the
|
||||||
// inbox assigned to us by the contact
|
// inbox assigned to us by the contact
|
||||||
@@ -99,6 +111,7 @@ class ContactMailboxClient implements MailboxClient {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deassignContactForDownload(ContactId contactId) {
|
public void deassignContactForDownload(ContactId contactId) {
|
||||||
|
LOG.info("Contact deassigned for download");
|
||||||
MailboxWorker downloadWorker;
|
MailboxWorker downloadWorker;
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
downloadWorker = this.downloadWorker;
|
downloadWorker = this.downloadWorker;
|
||||||
|
|||||||
Reference in New Issue
Block a user