private void bufferDataUntilRecovery(ByteBuffer frame) throws Exception { if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info("Bufferring data until recovery is complete " + this.runtimeId); } if (frameCollection == null) { this.frameCollection = (FrameCollection) feedManager .getFeedMemoryManager() .getMemoryComponent(IFeedMemoryComponent.Type.COLLECTION); } if (frameCollection == null) { discarder.processMessage(frame); if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning("Running low on memory! DISCARDING FRAME "); } } else { boolean success = frameCollection.addFrame(frame); if (!success) { if (fpa.spillToDiskOnCongestion()) { if (frame != null) { spiller.processMessage(frame); } // TODO handle the else case } else { discarder.processMessage(frame); } } } }
private void processBufferredBacklog() throws HyracksDataException { try { if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info("Processing backlog " + this.runtimeId); } if (frameCollection != null) { Iterator<ByteBuffer> backlog = frameCollection.getFrameCollectionIterator(); while (backlog.hasNext()) { process(backlog.next()); nProcessed++; } DataBucket bucket = pool.getDataBucket(); bucket.setContentType(ContentType.EOSD); bucket.setDesiredReadCount(1); mBuffer.sendMessage(bucket); feedManager.getFeedMemoryManager().releaseMemoryComponent(frameCollection); frameCollection = null; } } catch (Exception e) { e.printStackTrace(); throw new HyracksDataException(e); } }