Apache9 commented on code in PR #4577:
URL: https://github.com/apache/hbase/pull/4577#discussion_r907494755
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/master/WorkerAssigner.java:
##########
@@ -60,27 +60,23 @@ public synchronized Optional<ServerName> acquire() {
.findAny();
worker.ifPresent(name -> currentWorkers.compute(name, (serverName,
availableWorker) -> availableWorker == null ? maxTasks - 1 :
availableWorker - 1));
+ event.suspend();
+ event.suspendIfNotReady(proc);
return worker;
}
public synchronized void release(ServerName serverName) {
currentWorkers.compute(serverName, (k, v) -> v == null ? null : v + 1);
- }
-
- public void suspend(Procedure<?> proc) {
- event.suspend();
- event.suspendIfNotReady(proc);
- }
-
- public void wake(MasterProcedureScheduler scheduler) {
if (!event.isReady()) {
- event.wake(scheduler);
+
event.wake(master.getMasterProcedureExecutor().getEnvironment().getProcedureScheduler());
}
}
@Override
public void serverAdded(ServerName worker) {
Review Comment:
Better to also add synchronized here?
--
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]