Incorrect order when instantiate ClientRemovedEvent

* Fix incorrect order in ClientRemovedEvent constructor
* Do not send an event if the events list is empty

Closes #30840

Signed-off-by: Pedro Ruivo <pruivo@redhat.com>
This commit is contained in:
Pedro Ruivo 2024-06-26 22:17:59 +01:00 committed by Alexander Schwartz
parent bce7a29035
commit 829e12b857
3 changed files with 7 additions and 1 deletions

View file

@ -141,6 +141,9 @@ public class InfinispanNotificationsManager {
void notify(String taskKey, Collection<? extends ClusterEvent> events, boolean ignoreSender, ClusterProvider.DCNotify dcNotify) {
if (events == null || events.isEmpty()) {
return;
}
var wrappedEvent = WrapperClusterEvent.wrap(taskKey, events, myAddress, mySite, dcNotify, ignoreSender);
String eventKey = UUID.randomUUID().toString();

View file

@ -85,6 +85,9 @@ public class RemoteInfinispanNotificationManager {
}
public void notify(String taskKey, Collection<? extends ClusterEvent> events, boolean ignoreSender, DCNotify dcNotify) {
if (events == null || events.isEmpty()) {
return;
}
var wrappedEvent = WrapperClusterEvent.wrap(taskKey, events, topologyInfo.getMyNodeName(), topologyInfo.getMySiteName(), dcNotify, ignoreSender);
var eventKey = UUID.randomUUID().toString();

View file

@ -52,7 +52,7 @@ public class ClientRemovedEvent extends BaseClientEvent {
public static ClientRemovedEvent create(ClientModel client) {
var clientRoles = client.getRolesStream().collect(Collectors.toMap(RoleModel::getId, RoleModel::getName));
return new ClientRemovedEvent(client.getId(), client.getClientId(), client.getRealm().getId(), clientRoles);
return new ClientRemovedEvent(client.getId(), client.getRealm().getId(), client.getClientId(), clientRoles);
}