kylixs commented on a change in pull request #9033:
URL: https://github.com/apache/dubbo/pull/9033#discussion_r727963015
##########
File path:
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultModuleDeployer.java
##########
@@ -219,7 +226,9 @@ private void onModuleStarting() {
private void onModuleStarted(CompletableFuture startFuture) {
setStarted();
logger.info(getIdentifier() + " has started.");
- applicationDeployer.checkStarted(startFuture);
+ applicationDeployer.checkStarted();
+ // complete module start future after application state changed, fix
#9012 ?
+ startFuture.complete(true);
Review comment:
The `DefaultApplicationDeployer.checkStarted()` function is used to
check all modules state and notify start checking.
If start by module manually in some scenario, maybe some modules are
started, but the application is starting until all modules are started.
```java
private void doStart() {
startModules();
// prepare application instance
prepareApplicationInstance();
executorRepository.getSharedExecutor().submit(() -> {
while (true) {
// notify on each module started
synchronized (startedLock) {
try {
startedLock.wait(500);
} catch (InterruptedException e) {
// ignore
}
}
// if has new module, do start again
if (hasPendingModule()) {
startModules();
continue;
}
DeployState state = checkState();
if (!(state == DeployState.STARTING || state ==
DeployState.PENDING)) {
// start finished or error
break;
}
}
});
}
....
public void checkStarted() {
// TODO improve state checking
DeployState _state = checkState();
switch (_state) {
case STARTED:
onStarted();
break;
case STARTING:
onStarting();
break;
case PENDING:
setPending();
break;
}
// notify started
synchronized (startedLock) {
startedLock.notifyAll();
}
}
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]