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

    https://github.com/apache/flink/pull/1017#discussion_r37142604
  
    --- Diff: 
flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/runtime/tasks/TwoInputStreamTask.java
 ---
    @@ -27,114 +26,65 @@
     import org.apache.flink.streaming.api.graph.StreamEdge;
     import org.apache.flink.streaming.api.operators.TwoInputStreamOperator;
     import org.apache.flink.streaming.runtime.io.StreamTwoInputProcessor;
    -import org.slf4j.Logger;
    -import org.slf4j.LoggerFactory;
     
     public class TwoInputStreamTask<IN1, IN2, OUT> extends StreamTask<OUT, 
TwoInputStreamOperator<IN1, IN2, OUT>> {
     
    -   private static final Logger LOG = 
LoggerFactory.getLogger(TwoInputStreamTask.class);
    -
        private StreamTwoInputProcessor<IN1, IN2> inputProcessor;
    +   
    +   private volatile boolean running = true;
     
        @Override
    -   public void registerInputOutput() {
    -           try {
    -                   super.registerInputOutput();
    +   public void init() throws Exception {
    +           TypeSerializer<IN1> inputDeserializer1 = 
configuration.getTypeSerializerIn1(userClassLoader);
    +           TypeSerializer<IN2> inputDeserializer2 = 
configuration.getTypeSerializerIn2(userClassLoader);
        
    -                   TypeSerializer<IN1> inputDeserializer1 = 
configuration.getTypeSerializerIn1(userClassLoader);
    -                   TypeSerializer<IN2> inputDeserializer2 = 
configuration.getTypeSerializerIn2(userClassLoader);
    +           int numberOfInputs = configuration.getNumberOfInputs();
        
    -                   int numberOfInputs = configuration.getNumberOfInputs();
    +           ArrayList<InputGate> inputList1 = new ArrayList<InputGate>();
    +           ArrayList<InputGate> inputList2 = new ArrayList<InputGate>();
        
    -                   ArrayList<InputGate> inputList1 = new 
ArrayList<InputGate>();
    -                   ArrayList<InputGate> inputList2 = new 
ArrayList<InputGate>();
    +           List<StreamEdge> inEdges = 
configuration.getInPhysicalEdges(userClassLoader);
        
    -                   List<StreamEdge> inEdges = 
configuration.getInPhysicalEdges(userClassLoader);
    -   
    -                   for (int i = 0; i < numberOfInputs; i++) {
    -                           int inputType = inEdges.get(i).getTypeNumber();
    -                           InputGate reader = 
getEnvironment().getInputGate(i);
    -                           switch (inputType) {
    -                                   case 1:
    -                                           inputList1.add(reader);
    -                                           break;
    -                                   case 2:
    -                                           inputList2.add(reader);
    -                                           break;
    -                                   default:
    -                                           throw new 
RuntimeException("Invalid input type number: " + inputType);
    -                           }
    +           for (int i = 0; i < numberOfInputs; i++) {
    +                   int inputType = inEdges.get(i).getTypeNumber();
    +                   InputGate reader = getEnvironment().getInputGate(i);
    +                   switch (inputType) {
    +                           case 1:
    +                                   inputList1.add(reader);
    +                                   break;
    +                           case 2:
    --- End diff --
    
    what about use a enum to instead of 2, it will be easier to understand it.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to