dmvk commented on a change in pull request #18526:
URL: https://github.com/apache/flink/pull/18526#discussion_r793424754



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionVertex.java
##########
@@ -283,15 +284,30 @@ public ArchivedExecution getPriorExecutionAttempt(int 
attemptNumber) {
         }
     }
 
-    public ArchivedExecution getLatestPriorExecution() {
-        synchronized (priorExecutions) {
-            final int size = priorExecutions.size();
-            if (size > 0) {
-                return priorExecutions.get(size - 1);
-            } else {
-                return null;
+    /**
+     * Gets the latest property from a prior execution that is not null.
+     *
+     * @param extractor defining the property to extract
+     * @param <T> type of the property
+     * @return Optional containing the latest property if it exists; otherwise 
{@code
+     *     Optional.empty()}.
+     */
+    private <T> Optional<T> getLatestPriorProperty(Function<ArchivedExecution, 
T> extractor) {

Review comment:
       Should we remove the synchronization from other places as well then? eg. 
`ExecutionVertex#getPriorExecutionAttempt`




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