Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadCommandSystem
Commits
380228fc
Commit
380228fc
authored
Apr 24, 2017
by
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/fr/ill/ics/nscclient/notification/DataNotificationClient.java
View file @
380228fc
...
...
@@ -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
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment