socket is now sequential and not concurrent

This commit is contained in:
Tommaso Rodolfo Masera 2020-03-25 14:50:05 +01:00
parent bcade19f52
commit e776b9c2e5

View file

@ -58,9 +58,9 @@ public class SensorSocketEndpoint extends Endpoint {
* @return number of successful transfer * @return number of successful transfer
*/ */
public long broadcast(Object message, User u) { 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() return sessions.stream()
.parallel()
.filter( .filter(
s -> { s -> {
if (s.isOpen()) return true; if (s.isOpen()) return true;