*
* @param events
*/
public void push(Collection<FpqEntry> events) {
if (shutdownInProgress) {
throw new FpqException("FPQ has been shutdown or is in progress, cannot push events");
}
// calculate memory used by the list of entries
long spaceRequired = 0;
for (FpqEntry entry : events) {
spaceRequired += entry.getMemorySize();
}
if (spaceRequired > maxSegmentSizeInBytes) {
throw new FpqException(String.format("the space required to push entries (%d) is greater than maximum segment size (%d) - increase segment size or reduce entry size", spaceRequired, maxSegmentSizeInBytes));
}
logger.debug("pushing {} event(s) totalling {} bytes", events.size(), spaceRequired);
MemorySegment segment;
while (true) {