Loading dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java +5 −23 Original line number Diff line number Diff line Loading @@ -36,8 +36,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import static org.apache.dolphinscheduler.common.Constants.COMMA; Loading Loading @@ -70,11 +68,6 @@ public class LowerWeightHostManager extends CommonHostManager { */ private ConcurrentHashMap<String, Set<HostWeight>> workerHostWeights; /** * worker group host lock */ private Lock lock; /** * executor service */ Loading @@ -84,7 +77,6 @@ public class LowerWeightHostManager extends CommonHostManager { public void init(){ this.selector = new LowerWeightRoundRobin(); this.workerHostWeights = new ConcurrentHashMap<>(); this.lock = new ReentrantLock(); this.executorService = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("LowerWeightHostManagerExecutor")); this.executorService.scheduleWithFixedDelay(new RefreshResourceTask(),35, 40, TimeUnit.SECONDS); this.roundRobinHostManager = new RoundRobinHostManager(); Loading Loading @@ -117,22 +109,12 @@ public class LowerWeightHostManager extends CommonHostManager { } private void syncWorkerHostWeight(Map<String, Set<HostWeight>> workerHostWeights) { lock.lock(); try { workerHostWeights.clear(); workerHostWeights.putAll(workerHostWeights); } finally { lock.unlock(); } this.workerHostWeights.clear(); this.workerHostWeights.putAll(workerHostWeights); } private Set<HostWeight> getWorkerHostWeights(String workerGroup) { lock.lock(); try { return workerHostWeights.get(workerGroup); } finally { lock.unlock(); } } class RefreshResourceTask implements Runnable{ Loading Loading
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java +5 −23 Original line number Diff line number Diff line Loading @@ -36,8 +36,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import static org.apache.dolphinscheduler.common.Constants.COMMA; Loading Loading @@ -70,11 +68,6 @@ public class LowerWeightHostManager extends CommonHostManager { */ private ConcurrentHashMap<String, Set<HostWeight>> workerHostWeights; /** * worker group host lock */ private Lock lock; /** * executor service */ Loading @@ -84,7 +77,6 @@ public class LowerWeightHostManager extends CommonHostManager { public void init(){ this.selector = new LowerWeightRoundRobin(); this.workerHostWeights = new ConcurrentHashMap<>(); this.lock = new ReentrantLock(); this.executorService = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("LowerWeightHostManagerExecutor")); this.executorService.scheduleWithFixedDelay(new RefreshResourceTask(),35, 40, TimeUnit.SECONDS); this.roundRobinHostManager = new RoundRobinHostManager(); Loading Loading @@ -117,22 +109,12 @@ public class LowerWeightHostManager extends CommonHostManager { } private void syncWorkerHostWeight(Map<String, Set<HostWeight>> workerHostWeights) { lock.lock(); try { workerHostWeights.clear(); workerHostWeights.putAll(workerHostWeights); } finally { lock.unlock(); } this.workerHostWeights.clear(); this.workerHostWeights.putAll(workerHostWeights); } private Set<HostWeight> getWorkerHostWeights(String workerGroup) { lock.lock(); try { return workerHostWeights.get(workerGroup); } finally { lock.unlock(); } } class RefreshResourceTask implements Runnable{ Loading