Brian O'Connor

EventuallyConsistentMapImpl: pushing serialization and sending to caller thread

This has the effect of limiting the caller so that it can't overrun the single thread that previously did the job.

If you let this back up, it will use all of your memory. :(

Change-Id: I0a3b93cfa7004e0430d228a68c60e2b7ba966d4e
......@@ -458,18 +458,24 @@ public class EventuallyConsistentMapImpl<K, V>
}
private void notifyPeers(InternalPutEvent event) {
broadcastMessageExecutor.execute(() -> broadcastMessage(updateMessageSubject, event));
// FIXME extremely memory expensive when we are overrun
// broadcastMessageExecutor.execute(() -> broadcastMessage(updateMessageSubject, event));
broadcastMessage(updateMessageSubject, event);
}
private void notifyPeers(InternalRemoveEvent event) {
broadcastMessageExecutor.execute(() -> broadcastMessage(removeMessageSubject, event));
// FIXME extremely memory expensive when we are overrun
// broadcastMessageExecutor.execute(() -> broadcastMessage(removeMessageSubject, event));
broadcastMessage(removeMessageSubject, event);
}
private void broadcastMessage(MessageSubject subject, Object event) {
// FIXME can we parallelize the serialization... use the caller???
ClusterMessage message = new ClusterMessage(
clusterService.getLocalNode().id(),
subject,
serializer.encode(event));
//broadcastMessageExecutor.execute(() -> clusterCommunicator.broadcast(message));
clusterCommunicator.broadcast(message);
}
......