Github user mjsax commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1398#discussion_r45731264
  
    --- Diff: 
flink-contrib/flink-storm-examples/src/main/java/org/apache/flink/storm/util/FiniteFileSpout.java
 ---
    @@ -32,46 +23,17 @@
     public class FiniteFileSpout extends FileSpout implements FiniteSpout {
        private static final long serialVersionUID = -1472978008607215864L;
     
    -   private String line;
    -   private boolean newLineRead;
    -
        public FiniteFileSpout() {}
     
        public FiniteFileSpout(String path) {
                super(path);
        }
     
    -   @SuppressWarnings("rawtypes")
    -   @Override
    -   public void open(final Map conf, final TopologyContext context, final 
SpoutOutputCollector collector) {
    -           super.open(conf, context, collector);
    -           newLineRead = false;
    -   }
    -
    -   @Override
    -   public void nextTuple() {
    -           this.collector.emit(new Values(line));
    -           newLineRead = false;
    -   }
    -
        /**
         * Can be called before nextTuple() any times including 0.
         */
        @Override
        public boolean reachedEnd() {
    -           try {
    -                   readLine();
    -           } catch (IOException e) {
    -                   throw new RuntimeException("Exception occured while 
reading file " + path);
    -           }
    -           return line == null;
    +           return finished;
        }
    --- End diff --
    
    It is more elegant. But you have already Flink in mind. Given the Flink 
agnostic `FileSpout` we have to do it this way. (assume you do not have the 
source code of `FileSpout` but only the class file and want to extend it with 
`FiniteSpout` interface)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to