Make new methods for undoing deletions synchronized.
This commit is contained in:
committed by
Jannis Mattheis
parent
dc9426bbae
commit
0ebeeec35e
@@ -60,7 +60,7 @@ public class MessageFacade {
|
|||||||
return state.getLastReceivedMessage();
|
return state.getLastReceivedMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteLocal(Message message) {
|
public synchronized void deleteLocal(Message message) {
|
||||||
this.state.removeMessage(message);
|
this.state.removeMessage(message);
|
||||||
// If there is already a deletion pending, that one should be executed before scheduling the
|
// If there is already a deletion pending, that one should be executed before scheduling the
|
||||||
// next deletion.
|
// next deletion.
|
||||||
@@ -70,12 +70,12 @@ public class MessageFacade {
|
|||||||
messagePendingDeletion = message;
|
messagePendingDeletion = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void commitDelete() {
|
public synchronized void commitDelete() {
|
||||||
this.requester.asyncRemoveMessage(messagePendingDeletion);
|
this.requester.asyncRemoveMessage(messagePendingDeletion);
|
||||||
messagePendingDeletion = null;
|
messagePendingDeletion = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PositionPair undoDeleteLocal() {
|
public synchronized PositionPair undoDeleteLocal() {
|
||||||
messagePendingDeletion = null;
|
messagePendingDeletion = null;
|
||||||
return this.state.undoLastRemoveMessage();
|
return this.state.undoLastRemoveMessage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class MessageStateHolder {
|
|||||||
return lastReceivedMessage;
|
return lastReceivedMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeMessage(Message message) {
|
synchronized void removeMessage(Message message) {
|
||||||
MessageState allMessages = state(MessageState.ALL_MESSAGES);
|
MessageState allMessages = state(MessageState.ALL_MESSAGES);
|
||||||
MessageState appMessages = state(message.getAppid());
|
MessageState appMessages = state(message.getAppid());
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ class MessageStateHolder {
|
|||||||
lastRemovedMessage = message;
|
lastRemovedMessage = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
PositionPair undoLastRemoveMessage() {
|
synchronized PositionPair undoLastRemoveMessage() {
|
||||||
PositionPair result = null;
|
PositionPair result = null;
|
||||||
|
|
||||||
if (lastRemovedMessage != null) {
|
if (lastRemovedMessage != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user