Commit 380228fc authored by legoc's avatar legoc
Browse files

branch for testing the change of order when an event arrives to the

client and already exists in the pending changes list.
parent 64edb978
......@@ -83,13 +83,23 @@ public class DataNotificationClient {
}
return instance;
}
private void updatePendingChanges(INotificationData change) {
// We do not add the change at the end of the list if it is already there.
// We used to move it at the end but some priority inversion could lead to problems.
if (!pendingChanges.contains(change)) {
pendingChanges.add(change);
} else {
//System.out.println("Not adding " + change);
}
}
public void propertyChanged(int databaseID, int propertyID) {
//System.out.println("Got property change with ID " + propertyID);
synchronized (pendingChanges) {
PropertyChangedNotificationData change = new PropertyChangedNotificationData(databaseID, propertyID);
pendingChanges.remove(change);
pendingChanges.add(change);
updatePendingChanges(change);
}
}
......@@ -97,8 +107,7 @@ public class DataNotificationClient {
//System.out.println("Got command state change with ID " + commandID + " with " + state);
synchronized (pendingChanges) {
CommandStateChangedNotificationData change = new CommandStateChangedNotificationData(databaseID, commandID, state);
pendingChanges.remove(change);
pendingChanges.add(change);
updatePendingChanges(change);
}
}
......@@ -106,40 +115,40 @@ public class DataNotificationClient {
//System.out.println("Got command progression change with ID " + commandID);
synchronized (pendingChanges) {
CommandProgressionChangedNotificationData change = new CommandProgressionChangedNotificationData(databaseID, commandID, progression);
pendingChanges.remove(change);
pendingChanges.add(change);
updatePendingChanges(change);
}
}
public void configurationChanged(int databaseID, int servantID, ClientEnableState enable) {
synchronized (pendingChanges) {
ConfigurationChangedNotificationData change = new ConfigurationChangedNotificationData(databaseID, servantID, enable);
pendingChanges.remove(change);
pendingChanges.add(change);
updatePendingChanges(change);
}
}
public void conditionStateChanged(int conditionId, boolean on, ClientConditionState clientState) {
synchronized (pendingChanges) {
ConditionStateChangedNotificationData change = new ConditionStateChangedNotificationData(conditionId, on, clientState);
pendingChanges.remove(change);
pendingChanges.add(change);
updatePendingChanges(change);
}
}
public void conditionActionsStateChanged(int conditionId, ClientConditionState clientState) {
synchronized (pendingChanges) {
ConditionActionsStateChangedNotificationData change = new ConditionActionsStateChangedNotificationData(conditionId, clientState);
pendingChanges.remove(change);
pendingChanges.add(change);
updatePendingChanges(change);
}
}
public void errorOccurred(String serverId, String message) {
synchronized (pendingServerErrors) {
ServerErrorEvent change = new ServerErrorEvent(serverId, "", "", message);
pendingChanges.remove(change);
pendingServerErrors.add(change);
// We do not add the change at the end of the list if it is already there.
// We used to move it at the end but some priority inversion could lead to problems.
if (!pendingServerErrors.contains(change)) {
pendingServerErrors.add(change);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment