Comments to indicate which locks guard which variables.

This commit is contained in:
akwizgran
2015-01-29 11:05:46 +00:00
parent 47bd84122e
commit 0dbfd7073f
21 changed files with 235 additions and 1092 deletions

View File

@@ -61,18 +61,18 @@ Service, EventListener {
private final Executor dbExecutor;
private final EventBus eventBus;
private final Context appContext;
private final Lock synchLock = new ReentrantLock();
// The following are locking: synchLock
private final Map<ContactId, Integer> contactCounts =
new HashMap<ContactId, Integer>();
private final Map<GroupId, Integer> groupCounts =
new HashMap<GroupId, Integer>();
private int privateTotal = 0, groupTotal = 0;
private int nextRequestId = 0;
private volatile Settings settings = new Settings();
private final Lock synchLock = new ReentrantLock();
@Inject
public AndroidNotificationManagerImpl(DatabaseComponent db,
@DatabaseExecutor Executor dbExecutor, EventBus eventBus,
@@ -136,6 +136,7 @@ Service, EventListener {
}
}
// Locking: synchLock
private void updatePrivateMessageNotification() {
if(privateTotal == 0) {
clearPrivateMessageNotification();
@@ -180,6 +181,7 @@ Service, EventListener {
}
}
// Locking: synchLock
private void clearPrivateMessageNotification() {
Object o = appContext.getSystemService(NOTIFICATION_SERVICE);
NotificationManager nm = (NotificationManager) o;
@@ -222,6 +224,7 @@ Service, EventListener {
}
}
// Locking: synchLock
private void updateGroupPostNotification() {
if(groupTotal == 0) {
clearGroupPostNotification();
@@ -266,6 +269,7 @@ Service, EventListener {
}
}
// Locking: synchLock
private void clearGroupPostNotification() {
Object o = appContext.getSystemService(NOTIFICATION_SERVICE);
NotificationManager nm = (NotificationManager) o;