You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2018/08/28 12:02:17 UTC
[GitHub] chickenlj closed pull request #2375: [Dubbo-1814][Baiji-3]Add xml
config support for graceful shutdown timeout. (#1814)
chickenlj closed pull request #2375: [Dubbo-1814][Baiji-3]Add xml config support for graceful shutdown timeout. (#1814)
URL: https://github.com/apache/incubator-dubbo/pull/2375
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
index d7fe35d3b9..cf9ad93b5b 100644
--- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
+++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
@@ -62,6 +62,7 @@
public class DubboProtocol extends AbstractProtocol {
public static final String NAME = "dubbo";
+ public static int wait = -1;
public static final int DEFAULT_PORT = 20880;
private static final String IS_CALLBACK_SERVICE_INVOKE = "_isCallBackServiceInvoke";
@@ -264,6 +265,11 @@ public int getDefaultPort() {
}
}
+ // set graceful shutdown wait time out
+ if (wait < 0){
+ wait = url.getParameter("shutdown.wait", 0);
+ }
+
openServer(url);
optimizeSerialization(url);
return exporter;
@@ -452,7 +458,7 @@ public void destroy() {
if (logger.isInfoEnabled()) {
logger.info("Close dubbo server: " + server.getLocalAddress());
}
- server.close(ConfigUtils.getServerShutdownTimeout());
+ server.close(wait >= 0 ? wait : ConfigUtils.getServerShutdownTimeout());
} catch (Throwable t) {
logger.warn(t.getMessage(), t);
}
@@ -466,7 +472,7 @@ public void destroy() {
if (logger.isInfoEnabled()) {
logger.info("Close dubbo connect: " + client.getLocalAddress() + "-->" + client.getRemoteAddress());
}
- client.close(ConfigUtils.getServerShutdownTimeout());
+ client.close(wait >= 0 ? wait : ConfigUtils.getServerShutdownTimeout());
} catch (Throwable t) {
logger.warn(t.getMessage(), t);
}
@@ -480,7 +486,7 @@ public void destroy() {
if (logger.isInfoEnabled()) {
logger.info("Close dubbo connect: " + client.getLocalAddress() + "-->" + client.getRemoteAddress());
}
- client.close(ConfigUtils.getServerShutdownTimeout());
+ client.close(wait >= 0 ? wait : ConfigUtils.getServerShutdownTimeout());
} catch (Throwable t) {
logger.warn(t.getMessage(), t);
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org