Add wait for worker shutdown to MSQ task cancel (#14198)

* Add wait for worker shutdown to MSQ task cancel

* Fix checkstyle
This commit is contained in:
Adarsh Sanjeev 2023-05-06 04:59:59 +05:30 committed by GitHub
parent 123c4908c8
commit fb38085ddb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -355,6 +355,8 @@ public class ControllerImpl implements Controller
throw new MSQException(CanceledFault.INSTANCE);
}
);
workerTaskLauncher.waitForWorkerShutdown();
}
public TaskStatus runTask(final Closer closer)

View File

@ -205,12 +205,7 @@ public class MSQWorkerTaskLauncher
}
// Block until stopped.
try {
FutureUtils.getUnchecked(stopFuture, false);
}
catch (Throwable ignored) {
// Suppress.
}
waitForWorkerShutdown();
}
/**
@ -309,6 +304,15 @@ public class MSQWorkerTaskLauncher
}
}
public void waitForWorkerShutdown()
{
try {
FutureUtils.getUnchecked(stopFuture, false);
}
catch (Throwable ignored) {
// Suppress.
}
}
/**
* Checks if the controller has canceled the input taskId. This method is used in {@link ControllerImpl}