This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new b4bb21a Remove unused property which retrieved from the URL (#7712)
b4bb21a is described below
commit b4bb21a91ebefffff80827e879cf43cc117326b4
Author: 灼华 <[email protected]>
AuthorDate: Thu May 13 11:49:00 2021 +0800
Remove unused property which retrieved from the URL (#7712)
* Remove unused property which retrieved from the URL
* Fix code style check
---
.../dubbo/remoting/transport/AbstractEndpoint.java | 22 ++-------------------
.../dubbo/remoting/transport/AbstractServer.java | 23 +++++-----------------
2 files changed, 7 insertions(+), 38 deletions(-)
diff --git
a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractEndpoint.java
b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractEndpoint.java
index 53ce72f..ec8a882 100644
---
a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractEndpoint.java
+++
b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractEndpoint.java
@@ -27,9 +27,6 @@ import org.apache.dubbo.remoting.Codec2;
import org.apache.dubbo.remoting.Constants;
import org.apache.dubbo.remoting.transport.codec.CodecAdapter;
-import static
org.apache.dubbo.common.constants.CommonConstants.DEFAULT_TIMEOUT;
-import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
-
/**
* AbstractEndpoint
*/
@@ -39,14 +36,11 @@ public abstract class AbstractEndpoint extends AbstractPeer
implements Resetable
private Codec2 codec;
- private int timeout;
-
private int connectTimeout;
public AbstractEndpoint(URL url, ChannelHandler handler) {
super(url, handler);
this.codec = getChannelCodec(url);
- this.timeout = url.getPositiveParameter(TIMEOUT_KEY, DEFAULT_TIMEOUT);
this.connectTimeout =
url.getPositiveParameter(Constants.CONNECT_TIMEOUT_KEY,
Constants.DEFAULT_CONNECT_TIMEOUT);
}
@@ -66,16 +60,7 @@ public abstract class AbstractEndpoint extends AbstractPeer
implements Resetable
throw new IllegalStateException("Failed to reset parameters "
+ url + ", cause: Channel closed. channel: " +
getLocalAddress());
}
- try {
- if (url.hasParameter(TIMEOUT_KEY)) {
- int t = url.getParameter(TIMEOUT_KEY, 0);
- if (t > 0) {
- this.timeout = t;
- }
- }
- } catch (Throwable t) {
- logger.error(t.getMessage(), t);
- }
+
try {
if (url.hasParameter(Constants.CONNECT_TIMEOUT_KEY)) {
int t = url.getParameter(Constants.CONNECT_TIMEOUT_KEY, 0);
@@ -86,6 +71,7 @@ public abstract class AbstractEndpoint extends AbstractPeer
implements Resetable
} catch (Throwable t) {
logger.error(t.getMessage(), t);
}
+
try {
if (url.hasParameter(Constants.CODEC_KEY)) {
this.codec = getChannelCodec(url);
@@ -104,10 +90,6 @@ public abstract class AbstractEndpoint extends AbstractPeer
implements Resetable
return codec;
}
- protected int getTimeout() {
- return timeout;
- }
-
protected int getConnectTimeout() {
return connectTimeout;
}
diff --git
a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractServer.java
b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractServer.java
index 967d8d2..716eaf6 100644
---
a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractServer.java
+++
b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractServer.java
@@ -37,8 +37,6 @@ import static
org.apache.dubbo.common.constants.CommonConstants.ANYHOST_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_VALUE;
import static org.apache.dubbo.remoting.Constants.ACCEPTS_KEY;
import static org.apache.dubbo.remoting.Constants.DEFAULT_ACCEPTS;
-import static org.apache.dubbo.remoting.Constants.DEFAULT_IDLE_TIMEOUT;
-import static org.apache.dubbo.remoting.Constants.IDLE_TIMEOUT_KEY;
/**
* AbstractServer
@@ -51,7 +49,6 @@ public abstract class AbstractServer extends AbstractEndpoint
implements Remotin
private InetSocketAddress localAddress;
private InetSocketAddress bindAddress;
private int accepts;
- private int idleTimeout;
private ExecutorRepository executorRepository =
ExtensionLoader.getExtensionLoader(ExecutorRepository.class).getDefaultExtension();
@@ -66,7 +63,6 @@ public abstract class AbstractServer extends AbstractEndpoint
implements Remotin
}
bindAddress = new InetSocketAddress(bindIp, bindPort);
this.accepts = url.getParameter(ACCEPTS_KEY, DEFAULT_ACCEPTS);
- this.idleTimeout = url.getParameter(IDLE_TIMEOUT_KEY,
DEFAULT_IDLE_TIMEOUT);
try {
doOpen();
if (logger.isInfoEnabled()) {
@@ -88,6 +84,7 @@ public abstract class AbstractServer extends AbstractEndpoint
implements Remotin
if (url == null) {
return;
}
+
try {
if (url.hasParameter(ACCEPTS_KEY)) {
int a = url.getParameter(ACCEPTS_KEY, 0);
@@ -98,16 +95,7 @@ public abstract class AbstractServer extends
AbstractEndpoint implements Remotin
} catch (Throwable t) {
logger.error(t.getMessage(), t);
}
- try {
- if (url.hasParameter(IDLE_TIMEOUT_KEY)) {
- int t = url.getParameter(IDLE_TIMEOUT_KEY, 0);
- if (t > 0) {
- this.idleTimeout = t;
- }
- }
- } catch (Throwable t) {
- logger.error(t.getMessage(), t);
- }
+
executorRepository.updateThreadpool(url, executor);
super.setUrl(getUrl().addParameters(url.getParameters()));
}
@@ -127,12 +115,15 @@ public abstract class AbstractServer extends
AbstractEndpoint implements Remotin
if (logger.isInfoEnabled()) {
logger.info("Close " + getClass().getSimpleName() + " bind " +
getBindAddress() + ", export " + getLocalAddress());
}
+
ExecutorUtil.shutdownNow(executor, 100);
+
try {
super.close();
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
}
+
try {
doClose();
} catch (Throwable e) {
@@ -159,10 +150,6 @@ public abstract class AbstractServer extends
AbstractEndpoint implements Remotin
return accepts;
}
- public int getIdleTimeout() {
- return idleTimeout;
- }
-
@Override
public void connected(Channel ch) throws RemotingException {
// If the server has entered the shutdown process, reject any new
connection