You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/11/20 10:27:48 UTC

[GitHub] [flink] GJL commented on a change in pull request #10255: [FLINK-14859][runtime] Avoid leaking unassigned slots

GJL commented on a change in pull request #10255: [FLINK-14859][runtime] Avoid leaking unassigned slots 
URL: https://github.com/apache/flink/pull/10255#discussion_r348402354
 
 

 ##########
 File path: flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/TestExecutionSlotAllocator.java
 ##########
 @@ -126,4 +131,13 @@ public void cancel(final ExecutionVertexID executionVertexId) {
 	public CompletableFuture<Void> stop() {
 		return CompletableFuture.completedFuture(null);
 	}
+
+	@Override
+	public void returnLogicalSlot(final LogicalSlot logicalSlot) {
+		returnedSlots.add(logicalSlot);
+	}
+
+	public List<LogicalSlot> getReturnedSlots() {
+		return new ArrayList<>(returnedSlots);
 
 Review comment:
   It has slightly different semantics. `unmodifiableList()` does not create a copy.
   
   Example:
   ```
   public static void main(String[] args) {
   		final List<String> s = new ArrayList<>();
   		final List<String> su = Collections.unmodifiableList(s);
   		s.add("foo");
   		System.out.println(su);
   	}
   ```
   
   output:
   `[foo]`
   
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services