Merge branch '45-solve-concurrency-issues-with-socket-updates-from-sensorsocket' into 'dev'

Resolve "Solve concurrency issues with socket updates from SensorSocket"

Closes #45

See merge request sa4-2020/the-sanmarinoes/backend!57
This commit is contained in:
Matteo Omenetti 2020-03-25 14:53:44 +01:00
commit c8121d8473

View file

@ -58,9 +58,9 @@ public class SensorSocketEndpoint extends Endpoint {
* @return number of successful transfer
*/
public long broadcast(Object message, User u) {
final Collection<Session> sessions = authorizedClients.get(u);
final HashSet<Session> sessions = new HashSet<>(authorizedClients.get(u));
return sessions.stream()
.parallel()
.filter(
s -> {
if (s.isOpen()) return true;