amaliujia commented on a change in pull request #14480:
URL: https://github.com/apache/beam/pull/14480#discussion_r612806588
##########
File path:
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/data/QueueingBeamFnDataClient.java
##########
@@ -193,16 +287,24 @@ public void accept(T value) throws Exception {
}
}
- static class ConsumerAndData<T> {
- private final FnDataReceiver<T> consumer;
- private final T data;
+ private static class ConsumerAndData<T> {
+ private final @Nullable FnDataReceiver<T> consumer;
+ private final @Nullable T data;
+
+ public ConsumerAndData() {
+ this.consumer = null;
+ this.data = null;
+ }
public ConsumerAndData(FnDataReceiver<T> receiver, T data) {
this.consumer = receiver;
this.data = data;
}
void accept() throws Exception {
+ if (consumer == null || data == null) {
+ throw new IllegalStateException("cannot accept POISON");
Review comment:
As this is dealing with a special case, can you leave some comments to
explain when this could happen? (e.g. consumer or data is null then it must be
POSION)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]