Repository: alibaba/fescar
Pull request #413 (2019-02-15 11:33:08)

NettyClientConfig Class member variable named incorrectly
<!-- Please make sure you have read and understood the contributing guidelines -->

### Ⅰ. Describe what this PR did
Rename the member variable DEFAULT_POOL_FIFO in the NettyClientConfig class, Because the config object is actually assigned to a LIFO rather than a FIFO
### Ⅱ. Does this pull request fix one issue?
<!-- If that, add "fixes #xxx" below in the next line, for example, fixes #97. -->


### Ⅲ. Why don't you add test cases (unit test/integration test)? 
Because it already exists

### Ⅳ. Describe how to verify it


### Ⅴ. Special notes for reviews


CLAassistant: [![CLA assistant check](https://cla-assistant.io/pull/badge/not_signed)](https://cla-assistant.io/alibaba/fescar?pullRequest=413) <br/>Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our [Contributor License Agreement](https://cla-assistant.io/alibaba/fescar?pullRequest=413) before we can accept your contribution.<br/><hr/>**徐晓飞** seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please [add the email address used for this commit to your account](https://help.github.com/articles/why-are-my-commits-linked-to-the-wrong-user/#commits-are-not-linked-to-any-user).<br/><sub>You have signed the CLA already but the status is still pending? Let us [recheck](https://cla-assistant.io/check/alibaba/fescar?pullRequest=413) it.</sub>
codecov-io: # [Codecov](https://codecov.io/gh/alibaba/fescar/pull/413?src=pr&el=h1) Report
> Merging [#413](https://codecov.io/gh/alibaba/fescar/pull/413?src=pr&el=desc) into [develop](https://codecov.io/gh/alibaba/fescar/commit/70fbeaf5f9dffcfe34689e90ad845d7c4f10079d?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `88.88%`.

[![Impacted file tree graph](https://codecov.io/gh/alibaba/fescar/pull/413/graphs/tree.svg?width=650&token=Hy9a6MCc4p&height=150&src=pr)](https://codecov.io/gh/alibaba/fescar/pull/413?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##             develop    #413   +/-   ##
=========================================
  Coverage       29.7%   29.7%           
  Complexity       626     626           
=========================================
  Files            176     176           
  Lines           6958    6958           
  Branches         846     846           
=========================================
  Hits            2067    2067           
  Misses          4675    4675           
  Partials         216     216
```


| [Impacted Files](https://codecov.io/gh/alibaba/fescar/pull/413?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...com/alibaba/fescar/core/rpc/netty/RmRpcClient.java](https://codecov.io/gh/alibaba/fescar/pull/413/diff?src=pr&el=tree#diff-Y29yZS9zcmMvbWFpbi9qYXZhL2NvbS9hbGliYWJhL2Zlc2Nhci9jb3JlL3JwYy9uZXR0eS9SbVJwY0NsaWVudC5qYXZh) | `0% <0%> (ø)` | `0 <0> (ø)` | :arrow_down: |
| [...com/alibaba/fescar/core/rpc/netty/TmRpcClient.java](https://codecov.io/gh/alibaba/fescar/pull/413/diff?src=pr&el=tree#diff-Y29yZS9zcmMvbWFpbi9qYXZhL2NvbS9hbGliYWJhL2Zlc2Nhci9jb3JlL3JwYy9uZXR0eS9UbVJwY0NsaWVudC5qYXZh) | `24.24% <100%> (ø)` | `12 <0> (ø)` | :arrow_down: |
| [...ibaba/fescar/core/rpc/netty/NettyClientConfig.java](https://codecov.io/gh/alibaba/fescar/pull/413/diff?src=pr&el=tree#diff-Y29yZS9zcmMvbWFpbi9qYXZhL2NvbS9hbGliYWJhL2Zlc2Nhci9jb3JlL3JwYy9uZXR0eS9OZXR0eUNsaWVudENvbmZpZy5qYXZh) | `40.62% <100%> (ø)` | `19 <1> (ø)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/alibaba/fescar/pull/413?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/alibaba/fescar/pull/413?src=pr&el=footer). Last update [70fbeaf...b0529ad](https://codecov.io/gh/alibaba/fescar/pull/413?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

xuxiaofei4519: Rename the member variable DEFAULT_POOL_FIFO in the NettyClientConfig class,
xuxiaofei4519: This naming problem makes it easy for users to misconfigure

Patch:
diff --git a/core/src/main/java/com/alibaba/fescar/core/rpc/netty/NettyClientConfig.java b/core/src/main/java/com/alibaba/fescar/core/rpc/netty/NettyClientConfig.java
index 51872a6fb..07af6db81 100644
--- a/core/src/main/java/com/alibaba/fescar/core/rpc/netty/NettyClientConfig.java
+++ b/core/src/main/java/com/alibaba/fescar/core/rpc/netty/NettyClientConfig.java
@@ -51,7 +51,7 @@ public class NettyClientConfig extends NettyBaseConfig {
     private static final int DEFAULT_MIN_POOL_IDLE = 0;
     private static final boolean DEFAULT_POOL_TEST_BORROW = true;
     private static final boolean DEFAULT_POOL_TEST_RETURN = true;
-    private static final boolean DEFAULT_POOL_FIFO = true;
+    private static final boolean DEFAULT_POOL_LIFO = true;
 
     /**
      * Gets connect timeout millis.
@@ -423,8 +423,8 @@ public class NettyClientConfig extends NettyBaseConfig {
      *
      * @return the boolean
      */
-    public boolean isPoolFifo() {
-        return DEFAULT_POOL_FIFO;
+    public boolean isPoolLifo() {
+        return DEFAULT_POOL_LIFO;
     }
 
     /**
diff --git a/core/src/main/java/com/alibaba/fescar/core/rpc/netty/RmRpcClient.java b/core/src/main/java/com/alibaba/fescar/core/rpc/netty/RmRpcClient.java
index 212349ade..2f57ee260 100644
--- a/core/src/main/java/com/alibaba/fescar/core/rpc/netty/RmRpcClient.java
+++ b/core/src/main/java/com/alibaba/fescar/core/rpc/netty/RmRpcClient.java
@@ -190,7 +190,7 @@ public final class RmRpcClient extends AbstractRpcRemotingClient {
         poolConfig.maxWait = rmClientConfig.getMaxAcquireConnMills();
         poolConfig.testOnBorrow = rmClientConfig.isPoolTestBorrow();
         poolConfig.testOnReturn = rmClientConfig.isPoolTestReturn();
-        poolConfig.lifo = rmClientConfig.isPoolFifo();
+        poolConfig.lifo = rmClientConfig.isPoolLifo();
         return poolConfig;
     }
 
diff --git a/core/src/main/java/com/alibaba/fescar/core/rpc/netty/TmRpcClient.java b/core/src/main/java/com/alibaba/fescar/core/rpc/netty/TmRpcClient.java
index 5cdd38af1..5632b1678 100644
--- a/core/src/main/java/com/alibaba/fescar/core/rpc/netty/TmRpcClient.java
+++ b/core/src/main/java/com/alibaba/fescar/core/rpc/netty/TmRpcClient.java
@@ -83,7 +83,7 @@ public final class TmRpcClient extends AbstractRpcRemotingClient {
     private final AtomicBoolean initialized = new AtomicBoolean(false);
     private String applicationId;
     private String transactionServiceGroup;
-    private final NettyClientConfig nettyClientConfig;
+    private final NettyClientConfig tmClientConfig;
     private final ConcurrentMap<String, NettyPoolKey> poolKeyMap
         = new ConcurrentHashMap<String, NettyPoolKey>();
     /**
@@ -95,7 +95,7 @@ public final class TmRpcClient extends AbstractRpcRemotingClient {
                         EventExecutorGroup eventExecutorGroup,
                         ThreadPoolExecutor messageExecutor) {
         super(nettyClientConfig, eventExecutorGroup, messageExecutor);
-        this.nettyClientConfig = nettyClientConfig;
+        this.tmClientConfig = nettyClientConfig;
     }
 
     /**
@@ -357,12 +357,12 @@ public final class TmRpcClient extends AbstractRpcRemotingClient {
     @Override
     protected Config getNettyPoolConfig() {
         Config poolConfig = new Config();
-        poolConfig.maxActive = nettyClientConfig.getMaxPoolActive();
-        poolConfig.minIdle = nettyClientConfig.getMinPoolIdle();
-        poolConfig.maxWait = nettyClientConfig.getMaxAcquireConnMills();
-        poolConfig.testOnBorrow = nettyClientConfig.isPoolTestBorrow();
-        poolConfig.testOnReturn = nettyClientConfig.isPoolTestReturn();
-        poolConfig.lifo = nettyClientConfig.isPoolFifo();
+        poolConfig.maxActive = tmClientConfig.getMaxPoolActive();
+        poolConfig.minIdle = tmClientConfig.getMinPoolIdle();
+        poolConfig.maxWait = tmClientConfig.getMaxAcquireConnMills();
+        poolConfig.testOnBorrow = tmClientConfig.isPoolTestBorrow();
+        poolConfig.testOnReturn = tmClientConfig.isPoolTestReturn();
+        poolConfig.lifo = tmClientConfig.isPoolLifo();
         return poolConfig;
     }
 


Test patch:
diff --git a/core/src/test/java/com/alibaba/fescar/core/rpc/netty/TmRpcClientTest.java b/core/src/test/java/com/alibaba/fescar/core/rpc/netty/TmRpcClientTest.java
index 699edd43b..9f943a2a5 100644
--- a/core/src/test/java/com/alibaba/fescar/core/rpc/netty/TmRpcClientTest.java
+++ b/core/src/test/java/com/alibaba/fescar/core/rpc/netty/TmRpcClientTest.java
@@ -60,7 +60,7 @@ public class TmRpcClientTest {
         Assert.assertEquals(defaultNettyClientConfig.getMaxAcquireConnMills(), config.maxWait);
         Assert.assertEquals(defaultNettyClientConfig.isPoolTestBorrow(), config.testOnBorrow);
         Assert.assertEquals(defaultNettyClientConfig.isPoolTestReturn(), config.testOnReturn);
-        Assert.assertEquals(defaultNettyClientConfig.isPoolFifo(), config.lifo);
+        Assert.assertEquals(defaultNettyClientConfig.isPoolLifo(), config.lifo);
     }
 
     /**