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 discard(ByteBuffer frame) throws Exception {
   boolean success = discarder.processMessage(frame);
   if (!success) { // limit reached
     reportUnresolvableCongestion();
   }
 }
 protected void process(ByteBuffer frame) throws HyracksDataException {
   boolean frameProcessed = false;
   while (!frameProcessed) {
     try {
       if (!bufferingEnabled) {
         coreOperator.nextFrame(frame); // synchronous
         mBuffer.sendReport(frame);
       } else {
         DataBucket bucket = pool.getDataBucket();
         if (bucket != null) {
           if (frame != null) {
             bucket.reset(frame); // created a copy here
             bucket.setContentType(ContentType.DATA);
           } else {
             bucket.setContentType(ContentType.EOD);
           }
           bucket.setDesiredReadCount(1);
           mBuffer.sendMessage(bucket);
           mBuffer.sendReport(frame);
           nProcessed++;
         } else {
           if (fpa.spillToDiskOnCongestion()) {
             if (frame != null) {
               boolean spilled = spiller.processMessage(frame);
               if (spilled) {
                 setMode(Mode.SPILL);
               } else {
                 reportUnresolvableCongestion();
               }
             }
           } else if (fpa.discardOnCongestion()) {
             boolean discarded = discarder.processMessage(frame);
             if (!discarded) {
               reportUnresolvableCongestion();
             }
           } else if (fpa.throttlingEnabled()) {
             setThrottlingEnabled(true);
           } else {
             reportUnresolvableCongestion();
           }
         }
       }
       frameProcessed = true;
     } catch (Exception e) {
       if (feedPolicyAccessor.continueOnSoftFailure()) {
         frame = exceptionHandler.handleException(e, frame);
         if (frame == null) {
           frameProcessed = true;
           if (LOGGER.isLoggable(Level.WARNING)) {
             LOGGER.warning(
                 "Encountered exception! "
                     + e.getMessage()
                     + "Insufficient information, Cannot extract failing tuple");
           }
         }
       } else {
         if (LOGGER.isLoggable(Level.WARNING)) {
           LOGGER.warning(
               "Ingestion policy does not require recovering from tuple. Feed would terminate");
         }
         mBuffer.close(false);
         throw new HyracksDataException(e);
       }
     }
   }
 }