@Override public boolean receiveImage(ImageToProcess img,Set<TaskImageContainer> tasks,boolean blockUntilImageRelease,boolean closeOnImageRelease,Optional<Runnable> runnableWhenDone) throws InterruptedException {
  if (tasks == null || tasks.size() <= 0) {
    return false;
  }
  if (img == null) {
    throw new RuntimeException("ERROR: Initial call must reference valid Image!");
  }
  int countImageRefs=numPropagatedImageReferences(img,tasks);
  initializeTaskDone(tasks,runnableWhenDone);
  ImageReleaseProtocol protocol=setSemaphoreReferenceCount(img,countImageRefs,blockUntilImageRelease,closeOnImageRelease);
  scheduleTasks(tasks);
  if (protocol.blockUntilRelease) {
    protocol.block();
  }
  return true;
}

@ Override public boolean receiveImage ( ImageToProcess img , Set < TaskImageContainer > tasks , boolean blockUntilImageRelease , boolean closeOnImageRelease , Optional < Runnable > runnableWhenDone ) throws InterruptedException { if ( tasks == null || tasks . size ( ) <= 0 ) { return false ; } if ( img == null ) { throw new RuntimeException ( "ERROR: Initial call must reference valid Image!" ) ; } int countImageRefs = numPropagatedImageReferences ( img , tasks ) ; initializeTaskDone ( tasks , runnableWhenDone ) ; ImageReleaseProtocol protocol = setSemaphoreReferenceCount ( img , countImageRefs , blockUntilImageRelease , closeOnImageRelease ) ; scheduleTasks ( tasks ) ; if ( protocol . blockUntilRelease ) { protocol . block ( ) ; } return true ; }
implements that top - level image single task submission that is defined by the imageconsumer interface .
