flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tillrohrmann <...@git.apache.org>
Subject [GitHub] flink pull request #2110: [FLINK-3974] Fix object reuse with multi-chaining
Date Thu, 23 Jun 2016 14:05:51 GMT
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2110#discussion_r68240257
  
    --- Diff: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/OperatorChain.java
---
    @@ -386,4 +402,23 @@ public void close() {
     			}
     		}
     	}
    +
    +	/**
    +	 * Special version of {@link BroadcastingOutputCollector} that performs a shallow copy
of the
    +	 * {@link StreamRecord} to ensure that multi-chaining works correctly.
    +	 */
    +	private static final class CopyingBroadcastingOutputCollector<T> extends BroadcastingOutputCollector<T>
{
    +
    +		public CopyingBroadcastingOutputCollector(Output<StreamRecord<T>>[] outputs)
{
    +			super(outputs);
    +		}
    +
    +		@Override
    +		public void collect(StreamRecord<T> record) {
    +			for (Output<StreamRecord<T>> output : outputs) {
    +				StreamRecord<T> shallowCopy = record.copy(record.getValue());
    +				output.collect(shallowCopy);
    +			}
    --- End diff --
    
    Here, the same. I think we could save one copying operation by giving the original `record`
to the last output.


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

Mime
View raw message