You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2019/07/08 13:34:06 UTC
[flink] 03/10: [hotfix] [runtime] Improve slot profile computation
in TaskManagerServices
This is an automated email from the ASF dual-hosted git repository.
sewen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 5a056935778d8ae9d9502a2f3833d7fc72b77d22
Author: Stephan Ewen <se...@apache.org>
AuthorDate: Sun Jul 7 18:46:38 2019 +0200
[hotfix] [runtime] Improve slot profile computation in TaskManagerServices
In particular, this avoid repeatedly performing the computation, for each slot.
---
.../apache/flink/runtime/taskexecutor/TaskManagerServices.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerServices.java b/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerServices.java
index dfcd5e2..ee00dde 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerServices.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerServices.java
@@ -50,7 +50,6 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Executor;
@@ -263,11 +262,8 @@ public class TaskManagerServices {
final BroadcastVariableManager broadcastVariableManager = new BroadcastVariableManager();
final int numOfSlots = taskManagerServicesConfiguration.getNumberOfSlots();
- final List<ResourceProfile> resourceProfiles = new ArrayList<>(numOfSlots);
-
- for (int i = 0; i < taskManagerServicesConfiguration.getNumberOfSlots(); i++) {
- resourceProfiles.add(computeSlotResourceProfile(numOfSlots, managedMemorySize));
- }
+ final List<ResourceProfile> resourceProfiles =
+ Collections.nCopies(numOfSlots, computeSlotResourceProfile(numOfSlots, managedMemorySize));
final TimerService<AllocationID> timerService = new TimerService<>(
new ScheduledThreadPoolExecutor(1),