1. 我同意您的说法,Dubbo容器不局限于Spring,可能我描述不太好,目前我们实际应用中使用的容器就是Spring。
2. 确实您没有正面回答我的问题,那么我描述下2.6.3版本停机在如下场景下存在问题:如果应用程序通过停机hook触发,DubboShutDown
Hook会调用destroyAll方法,因为容器(比如Spring)也通过Hook停机,此时Spirng会提前关闭,可能导致dubbo方法内部无法获取业务Bean。因为多个hook的执行的无序性,destroyAll方法第二次执行会立即返回,所以可能导致容器先摧毁。
3. 关于第三个问题,在2.6.1中ProtocolConfig类中,destroyAll方法包含如下sleep代码。2.6.2中将此部分sleep代码删除了。
2.6.1:
public static void destroyAll() {
if (!destroyed.compareAndSet(false, true)) {
return;
}
AbstractRegistryFactory.destroyAll();
// Wait for registry notification
try {
**Thread.sleep(ConfigUtils.getServerShutdownTimeout());**
} catch (InterruptedException e) {
logger.warn("Interrupted unexpectedly when waiting for registry
notification during shutdown process!");
}
ExtensionLoader<Protocol> loader =
ExtensionLoader.getExtensionLoader(Protocol.class);
for (String protocolName : loader.getLoadedExtensions()) {
try {
Protocol protocol = loader.getLoadedExtension(protocolName);
if (protocol != null) {
protocol.destroy();
}
} catch (Throwable t) {
logger.warn(t.getMessage(), t);
}
}
}
2.6.2:
// TODO: 2017/8/30 to move this method somewhere else
public static void destroyAll() {
if (!destroyed.compareAndSet(false, true)) {
return;
}
AbstractRegistryFactory.destroyAll();
ExtensionLoader<Protocol> loader =
ExtensionLoader.getExtensionLoader(Protocol.class);
for (String protocolName : loader.getLoadedExtensions()) {
try {
Protocol protocol = loader.getLoadedExtension(protocolName);
if (protocol != null) {
protocol.destroy();
}
} catch (Throwable t) {
logger.warn(t.getMessage(), t);
}
}
}
[ Full content available at:
https://github.com/apache/incubator-dubbo/issues/2435 ]
This message was relayed via gitbox.apache.org for [email protected]