for (Byte version : protocolVersions) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
CougarObjectOutput out = objectIOFactory.newCougarObjectOutput(baos, version);
out.writeObject(new HeapDelta(heapState.getHeapId(), updateId, updatesThisBatch));
out.flush();
serialisedUpdatesByProtocolVersion.put(version, new EventMessage(baos.toByteArray()));
}
// now write these out for each session
for (IoSession session : heapState.getSessions()) {
nioLogger.log(NioLogger.LoggingLevel.TRANSPORT, session, "Sending heap delta of size %s and with updateId = %s for heapId = %s", updatesThisBatch.size(), updateId, heapState.getHeapId());
session.write(serialisedUpdatesByProtocolVersion.get(CougarProtocol.getProtocolVersion(session)));