You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "dugenkui03 (GitHub)" <gi...@apache.org> on 2018/10/09 10:18:56 UTC

[GitHub] [incubator-dubbo] dugenkui03 opened pull request #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

## What is the purpose of the change

#2610 

## Brief changelog

XXXXX

## Verifying this change

XXXXX

Follow this checklist to help us incorporate your contribution quickly and easily:

- [x] Make sure there is a [GITHUB_issue](https://github.com/apache/incubator-dubbo/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a GITHUB issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
- [ ] Format the pull request title like `[Dubbo-XXX] Fix UnknownException when host config not exist #XXX`. Each commit in the pull request should have a meaningful subject line and body.
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [ ] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/incubator-dubbo/tree/master/dubbo-test).
- [ ] Run `mvn clean install -DskipTests` & `mvn clean test-compile failsafe:integration-test` to make sure unit-test and integration-test pass.
- [ ] If this contribution is large, please follow the [Software Donation Guide](https://github.com/apache/incubator-dubbo/wiki/Software-donation-guide).


[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] codecov-io commented on issue #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "codecov-io (GitHub)" <gi...@apache.org>.
# [Codecov](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=h1) Report
> Merging [#2627](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-dubbo/commit/ccce69e75fd34a48f02899cb5a61c07742c17c43?src=pr&el=desc) will **decrease** coverage by `0.05%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/graphs/tree.svg?width=650&token=VnEIkiFQT0&height=150&src=pr)](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=tree)

```diff
@@             Coverage Diff             @@
##             master   #2627      +/-   ##
===========================================
- Coverage     55.16%   55.1%   -0.06%     
+ Complexity     5293    5286       -7     
===========================================
  Files           571     571              
  Lines         25521   25523       +2     
  Branches       4532    4532              
===========================================
- Hits          14078   14065      -13     
- Misses         9338    9347       +9     
- Partials       2105    2111       +6
```


| [Impacted Files](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...n/java/org/apache/dubbo/common/utils/LRUCache.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vdXRpbHMvTFJVQ2FjaGUuamF2YQ==) | `100% <100%> (+13.79%)` | `12 <7> (+1)` | :arrow_up: |
| [...he/dubbo/remoting/transport/netty/NettyClient.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JlbW90aW5nL3RyYW5zcG9ydC9uZXR0eS9OZXR0eUNsaWVudC5qYXZh) | `72.88% <0%> (-10.17%)` | `12% <0%> (-1%)` | |
| [.../dubbo/remoting/transport/netty4/NettyChannel.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHk0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy90cmFuc3BvcnQvbmV0dHk0L05ldHR5Q2hhbm5lbC5qYXZh) | `56.47% <0%> (-5.89%)` | `21% <0%> (-2%)` | |
| [...ubbo/rpc/protocol/dubbo/ChannelWrappedInvoker.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0NoYW5uZWxXcmFwcGVkSW52b2tlci5qYXZh) | `41.66% <0%> (-4.17%)` | `3% <0%> (ø)` | |
| [...rpc/protocol/dubbo/telnet/InvokeTelnetHandler.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL3RlbG5ldC9JbnZva2VUZWxuZXRIYW5kbGVyLmphdmE=) | `54.21% <0%> (-3.62%)` | `13% <0%> (-2%)` | |
| [...he/dubbo/remoting/transport/netty/NettyServer.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JlbW90aW5nL3RyYW5zcG9ydC9uZXR0eS9OZXR0eVNlcnZlci5qYXZh) | `67.85% <0%> (-3.58%)` | `8% <0%> (-1%)` | |
| [...e/dubbo/remoting/transport/netty4/NettyServer.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHk0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy90cmFuc3BvcnQvbmV0dHk0L05ldHR5U2VydmVyLmphdmE=) | `72.13% <0%> (-3.28%)` | `9% <0%> (-1%)` | |
| [...he/dubbo/registry/multicast/MulticastRegistry.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVnaXN0cnkvZHViYm8tcmVnaXN0cnktbXVsdGljYXN0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZWdpc3RyeS9tdWx0aWNhc3QvTXVsdGljYXN0UmVnaXN0cnkuamF2YQ==) | `55.6% <0%> (-1.73%)` | `35% <0%> (-3%)` | |
| [...dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0NhbGxiYWNrU2VydmljZUNvZGVjLmphdmE=) | `77.2% <0%> (-1.48%)` | `29% <0%> (ø)` | |
| [...apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0R1YmJvUHJvdG9jb2wuamF2YQ==) | `58.33% <0%> (-0.84%)` | `30% <0%> (-1%)` | |
| ... and [2 more](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?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/apache/incubator-dubbo/pull/2627?src=pr&el=footer). Last update [ccce69e...5b1e68b](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] carryxyh commented on issue #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "carryxyh (GitHub)" <gi...@apache.org>.
My fault.
Thx for your contribution, too.

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] carryxyh commented on pull request #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "carryxyh (GitHub)" <gi...@apache.org>.
agree with that can not be static.
but use upper with final field is better.
what do u think?

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] dugenkui03 commented on pull request #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "dugenkui03 (GitHub)" <gi...@apache.org>.
> agree.
> unnecessary lock. :)

>i ignored that  maxCapacity is volatile,and it is  threadSafe without lock.and size. size() with lock can assure memory visibility [参考](https://stackoverflow.com/questions/12429818/does-explicit-lock-automatically-provide-memory-visibility).i will fix it.

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] carryxyh commented on pull request #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "carryxyh (GitHub)" <gi...@apache.org>.
agree.
unnecessary lock. :)

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] dugenkui03 commented on pull request #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "dugenkui03 (GitHub)" <gi...@apache.org>.
> agree with that can not be static.
> but use upper with final field is better.
> what do u think?

This is also OK.Code style referred to the jdk before.will fix it.keep dubbo style is better.

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] carryxyh commented on pull request #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "carryxyh (GitHub)" <gi...@apache.org>.
why should add lock here?

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] codecov-io commented on issue #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "codecov-io (GitHub)" <gi...@apache.org>.
# [Codecov](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=h1) Report
> Merging [#2627](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-dubbo/commit/ccce69e75fd34a48f02899cb5a61c07742c17c43?src=pr&el=desc) will **increase** coverage by `0.02%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/graphs/tree.svg?width=650&token=VnEIkiFQT0&height=150&src=pr)](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=tree)

```diff
@@             Coverage Diff              @@
##             master    #2627      +/-   ##
============================================
+ Coverage     55.11%   55.14%   +0.02%     
- Complexity     5290     5292       +2     
============================================
  Files           571      571              
  Lines         25521    25529       +8     
  Branches       4532     4533       +1     
============================================
+ Hits          14067    14077      +10     
+ Misses         9347     9346       -1     
+ Partials       2107     2106       -1
```


| [Impacted Files](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...n/java/org/apache/dubbo/common/utils/LRUCache.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vdXRpbHMvTFJVQ2FjaGUuamF2YQ==) | `100% <100%> (+13.79%)` | `12 <11> (+1)` | :arrow_up: |
| [...he/dubbo/remoting/transport/netty/NettyClient.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JlbW90aW5nL3RyYW5zcG9ydC9uZXR0eS9OZXR0eUNsaWVudC5qYXZh) | `72.88% <0%> (-10.17%)` | `12% <0%> (-1%)` | |
| [...onfig/spring/extension/SpringExtensionFactory.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1zcHJpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy9zcHJpbmcvZXh0ZW5zaW9uL1NwcmluZ0V4dGVuc2lvbkZhY3RvcnkuamF2YQ==) | `79.31% <0%> (-6.9%)` | `11% <0%> (ø)` | |
| [.../java/org/apache/dubbo/config/ReferenceConfig.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy9SZWZlcmVuY2VDb25maWcuamF2YQ==) | `50.71% <0%> (+1.07%)` | `42% <0%> (ø)` | :arrow_down: |
| [.../dubbo/remoting/transport/netty4/NettyChannel.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHk0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy90cmFuc3BvcnQvbmV0dHk0L05ldHR5Q2hhbm5lbC5qYXZh) | `62.35% <0%> (+1.17%)` | `23% <0%> (+1%)` | :arrow_up: |
| [...he/dubbo/remoting/transport/netty/NettyServer.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JlbW90aW5nL3RyYW5zcG9ydC9uZXR0eS9OZXR0eVNlcnZlci5qYXZh) | `71.42% <0%> (+3.57%)` | `9% <0%> (+1%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?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/apache/incubator-dubbo/pull/2627?src=pr&el=footer). Last update [ccce69e...825e28b](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] carryxyh commented on issue #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "carryxyh (GitHub)" <gi...@apache.org>.
Thx for your contribution.

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] dugenkui03 commented on pull request #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "dugenkui03 (GitHub)" <gi...@apache.org>.
> Code style.
> Use RW_LOCK.
not `static final`,and i think `lock` can't be static.



[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] carryxyh commented on issue #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "carryxyh (GitHub)" <gi...@apache.org>.
LGTM.
@beiwei30 
Would u pls review this pr?

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] codecov-io commented on issue #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "codecov-io (GitHub)" <gi...@apache.org>.
# [Codecov](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=h1) Report
> Merging [#2627](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-dubbo/commit/ccce69e75fd34a48f02899cb5a61c07742c17c43?src=pr&el=desc) will **decrease** coverage by `0.05%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/graphs/tree.svg?width=650&token=VnEIkiFQT0&height=150&src=pr)](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=tree)

```diff
@@             Coverage Diff             @@
##             master   #2627      +/-   ##
===========================================
- Coverage     55.16%   55.1%   -0.06%     
+ Complexity     5293    5286       -7     
===========================================
  Files           571     571              
  Lines         25521   25523       +2     
  Branches       4532    4532              
===========================================
- Hits          14078   14065      -13     
- Misses         9338    9347       +9     
- Partials       2105    2111       +6
```


| [Impacted Files](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...n/java/org/apache/dubbo/common/utils/LRUCache.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vdXRpbHMvTFJVQ2FjaGUuamF2YQ==) | `100% <100%> (+13.79%)` | `12 <7> (+1)` | :arrow_up: |
| [...he/dubbo/remoting/transport/netty/NettyClient.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JlbW90aW5nL3RyYW5zcG9ydC9uZXR0eS9OZXR0eUNsaWVudC5qYXZh) | `72.88% <0%> (-10.17%)` | `12% <0%> (-1%)` | |
| [.../dubbo/remoting/transport/netty4/NettyChannel.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHk0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy90cmFuc3BvcnQvbmV0dHk0L05ldHR5Q2hhbm5lbC5qYXZh) | `56.47% <0%> (-5.89%)` | `21% <0%> (-2%)` | |
| [...ubbo/rpc/protocol/dubbo/ChannelWrappedInvoker.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0NoYW5uZWxXcmFwcGVkSW52b2tlci5qYXZh) | `41.66% <0%> (-4.17%)` | `3% <0%> (ø)` | |
| [...rpc/protocol/dubbo/telnet/InvokeTelnetHandler.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL3RlbG5ldC9JbnZva2VUZWxuZXRIYW5kbGVyLmphdmE=) | `54.21% <0%> (-3.62%)` | `13% <0%> (-2%)` | |
| [...he/dubbo/remoting/transport/netty/NettyServer.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JlbW90aW5nL3RyYW5zcG9ydC9uZXR0eS9OZXR0eVNlcnZlci5qYXZh) | `67.85% <0%> (-3.58%)` | `8% <0%> (-1%)` | |
| [...e/dubbo/remoting/transport/netty4/NettyServer.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHk0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy90cmFuc3BvcnQvbmV0dHk0L05ldHR5U2VydmVyLmphdmE=) | `72.13% <0%> (-3.28%)` | `9% <0%> (-1%)` | |
| [...he/dubbo/registry/multicast/MulticastRegistry.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVnaXN0cnkvZHViYm8tcmVnaXN0cnktbXVsdGljYXN0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZWdpc3RyeS9tdWx0aWNhc3QvTXVsdGljYXN0UmVnaXN0cnkuamF2YQ==) | `55.6% <0%> (-1.73%)` | `35% <0%> (-3%)` | |
| [...dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0NhbGxiYWNrU2VydmljZUNvZGVjLmphdmE=) | `77.2% <0%> (-1.48%)` | `29% <0%> (ø)` | |
| [...apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0R1YmJvUHJvdG9jb2wuamF2YQ==) | `58.33% <0%> (-0.84%)` | `30% <0%> (-1%)` | |
| ... and [2 more](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?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/apache/incubator-dubbo/pull/2627?src=pr&el=footer). Last update [ccce69e...5b1e68b](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] carryxyh closed pull request #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "carryxyh (GitHub)" <gi...@apache.org>.
[ pull request closed by carryxyh ]

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] dugenkui03 commented on pull request #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "dugenkui03 (GitHub)" <gi...@apache.org>.
> > i ignored that maxCapacity is volatile,
> 
> Yep, that is why I have questions with lock with this method.

Thx for your help. Code has been updated

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] dugenkui03 commented on pull request #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "dugenkui03 (GitHub)" <gi...@apache.org>.
> why should add lock here?

Just to keep the same style:original code add lock on method `size()`-this method just read variable in HashMap(`transient int size`).this method just read variable `maxCapacity`.

I think it's safe to remove lock,and that can improve the performance.

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] dugenkui03 commented on pull request #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "dugenkui03 (GitHub)" <gi...@apache.org>.
> > i ignored that maxCapacity is volatile,
> 
> Yep, that is why I have questions with lock with this method.

Thx for your help. Code has been updated.

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] dugenkui03 commented on pull request #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "dugenkui03 (GitHub)" <gi...@apache.org>.
> agree with that can not be static.
> but use upper with final field is better.
> what do u think?

This is also OK.Code style referred to the jdk before.


[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] codecov-io commented on issue #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "codecov-io (GitHub)" <gi...@apache.org>.
# [Codecov](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=h1) Report
> Merging [#2627](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-dubbo/commit/ccce69e75fd34a48f02899cb5a61c07742c17c43?src=pr&el=desc) will **decrease** coverage by `0.02%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/graphs/tree.svg?width=650&token=VnEIkiFQT0&height=150&src=pr)](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=tree)

```diff
@@             Coverage Diff              @@
##             master    #2627      +/-   ##
============================================
- Coverage     55.16%   55.13%   -0.03%     
+ Complexity     5293     5291       -2     
============================================
  Files           571      571              
  Lines         25521    25525       +4     
  Branches       4532     4532              
============================================
- Hits          14078    14073       -5     
- Misses         9338     9345       +7     
- Partials       2105     2107       +2
```


| [Impacted Files](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...n/java/org/apache/dubbo/common/utils/LRUCache.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vdXRpbHMvTFJVQ2FjaGUuamF2YQ==) | `100% <100%> (+13.79%)` | `12 <8> (+1)` | :arrow_up: |
| [...he/dubbo/remoting/transport/netty/NettyClient.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JlbW90aW5nL3RyYW5zcG9ydC9uZXR0eS9OZXR0eUNsaWVudC5qYXZh) | `72.88% <0%> (-10.17%)` | `12% <0%> (-1%)` | |
| [...ubbo/rpc/protocol/dubbo/ChannelWrappedInvoker.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0NoYW5uZWxXcmFwcGVkSW52b2tlci5qYXZh) | `41.66% <0%> (-4.17%)` | `3% <0%> (ø)` | |
| [...he/dubbo/remoting/transport/netty/NettyServer.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JlbW90aW5nL3RyYW5zcG9ydC9uZXR0eS9OZXR0eVNlcnZlci5qYXZh) | `67.85% <0%> (-3.58%)` | `8% <0%> (-1%)` | |
| [...bo/remoting/transport/netty/NettyCodecAdapter.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JlbW90aW5nL3RyYW5zcG9ydC9uZXR0eS9OZXR0eUNvZGVjQWRhcHRlci5qYXZh) | `53.12% <0%> (-1.57%)` | `3% <0%> (ø)` | |
| [...ache/dubbo/remoting/transport/mina/MinaClient.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbWluYS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcmVtb3RpbmcvdHJhbnNwb3J0L21pbmEvTWluYUNsaWVudC5qYXZh) | `56.92% <0%> (-1.54%)` | `8% <0%> (-1%)` | |
| [...dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0NhbGxiYWNrU2VydmljZUNvZGVjLmphdmE=) | `77.2% <0%> (-1.48%)` | `29% <0%> (ø)` | |
| [.../dubbo/remoting/transport/netty4/NettyChannel.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHk0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy90cmFuc3BvcnQvbmV0dHk0L05ldHR5Q2hhbm5lbC5qYXZh) | `61.17% <0%> (-1.18%)` | `22% <0%> (-1%)` | |
| [...apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL0R1YmJvUHJvdG9jb2wuamF2YQ==) | `58.33% <0%> (-0.84%)` | `30% <0%> (-1%)` | |
| [...org/apache/dubbo/rpc/filter/ActiveLimitFilter.java](https://codecov.io/gh/apache/incubator-dubbo/pull/2627/diff?src=pr&el=tree#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JwYy9maWx0ZXIvQWN0aXZlTGltaXRGaWx0ZXIuamF2YQ==) | `88.88% <0%> (+11.11%)` | `7% <0%> (+2%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?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/apache/incubator-dubbo/pull/2627?src=pr&el=footer). Last update [ccce69e...f192960](https://codecov.io/gh/apache/incubator-dubbo/pull/2627?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] dugenkui03 commented on pull request #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "dugenkui03 (GitHub)" <gi...@apache.org>.
> agree with that can not be static.
> but use upper with final field is better.
> what do u think?

This is also OK.Code style referred to the jdk before.will fix it.

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] carryxyh commented on pull request #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "carryxyh (GitHub)" <gi...@apache.org>.
> i ignored that maxCapacity is volatile,

Yep, that is why I have questions with lock with this method.

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] carryxyh commented on pull request #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "carryxyh (GitHub)" <gi...@apache.org>.
Code style.
Use RW_LOCK.

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] dugenkui03 commented on issue #2627: ReentrantReadWriteLock replace ReentrantLock in LRUCache

Posted by "dugenkui03 (GitHub)" <gi...@apache.org>.
> LGTM.
> @beiwei30
> Would u pls review this pr?

`get()` method in `LinkedHashMap`  is not threadsafe.that's a bad pr.
[details](https://blog.csdn.net/wawmg/article/details/19482041)

复盘最近PR为明天面试做准备的时候,突然发现这里不能用RWLock,因为其数据结构基础`linkedMap`的`get()`方法将会修改保持顺序的链表,即`get()`操作也有修改。感谢花费时间帮助review。

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2627 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org