Removing registered notifiers after a notification is processed.

This commit is contained in:
marcins78@gmail.com
2013-01-20 02:52:35 +00:00
parent 536976f00f
commit d5d87f52c1
4 changed files with 12 additions and 4 deletions

View File

@@ -51,8 +51,10 @@ public class GameCommunicationChannel implements GameStateListener, LongPollable
private synchronized void appendEvent(GameEvent event) { private synchronized void appendEvent(GameEvent event) {
_events.add(event); _events.add(event);
if (_waitingRequest != null) if (_waitingRequest != null) {
_waitingRequest.processRequest(); _waitingRequest.processRequest();
_waitingRequest = null;
}
} }
private int[] getCardIds(Collection<PhysicalCard> cards) { private int[] getCardIds(Collection<PhysicalCard> cards) {

View File

@@ -44,8 +44,10 @@ public class DraftCommunicationChannel implements LongPollableResource {
public synchronized void draftChanged() { public synchronized void draftChanged() {
_changed = true; _changed = true;
if (_waitingRequest != null) if (_waitingRequest != null) {
_waitingRequest.processRequest(); _waitingRequest.processRequest();
_waitingRequest = null;
}
} }
public boolean hasChangesInCommunicationChannel(DraftCardChoice draftCardChoice) { public boolean hasChangesInCommunicationChannel(DraftCardChoice draftCardChoice) {

View File

@@ -30,8 +30,10 @@ public class ChatCommunicationChannel implements ChatRoomListener, LongPollableR
@Override @Override
public synchronized void messageReceived(ChatMessage message) { public synchronized void messageReceived(ChatMessage message) {
_messages.add(message); _messages.add(message);
if (_waitingRequest != null) if (_waitingRequest != null) {
_waitingRequest.processRequest(); _waitingRequest.processRequest();
_waitingRequest = null;
}
} }
public synchronized List<ChatMessage> consumeMessages() { public synchronized List<ChatMessage> consumeMessages() {

View File

@@ -39,8 +39,10 @@ public class HallCommunicationChannel implements LongPollableResource {
public synchronized void hallChanged() { public synchronized void hallChanged() {
_changed = true; _changed = true;
if (_waitingRequest != null) if (_waitingRequest != null) {
_waitingRequest.processRequest(); _waitingRequest.processRequest();
_waitingRequest = null;
}
} }
public int getChannelNumber() { public int getChannelNumber() {