pnowojski commented on a change in pull request #16773:
URL: https://github.com/apache/flink/pull/16773#discussion_r688908275



##########
File path: 
flink-tests/src/test/java/org/apache/flink/runtime/operators/lifecycle/event/TestEventQueue.java
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.operators.lifecycle.event;
+
+import org.apache.flink.testutils.junit.SharedObjects;
+
+import java.io.Serializable;
+import java.util.List;
+
+/** A queue for {@link TestEvent}. */
+public interface TestEventQueue extends Serializable {

Review comment:
       What are those responsibilities? For me there is one responsibility. 
Provide a thread safe queue of events and listeners to process those events.
   
   And does it really matter? You are greatly complicating the code to 
encapsulate a single `SharedReference<TestEventQueue> delegate;` field. For 
that purpose you are adding something 100 lines of code? I don't think it's 
worth having to jump between three files to understand what's happening in a 
class that could have been implemented in [50 lines of 
code](https://github.com/pnowojski/flink/commit/e1599aebf7ca33934c189ef99fbaeedeb4c62491#diff-12701860aed3d52137cc6baa94116d9c1952bb967ee9d784ca03891d7099158e).
   
   (another issue) Especially that even with the current separation of concerns 
I'm not entirely sure if this `SharedTestEventQueue` is thread safe. For 
example I'm not sure if some test failures are not caused by race conditions on 
using it. And I would suggest to replace the `SharedReference`, two 
`CopyOnWriteArrayList` and `LinkedBlockingQueue` with just a single lock that 
would make reasoning about this class easier.




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to