Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SimpleDateFormat concurrent issue in CspFormatter #548

Merged
merged 1 commit into from
Mar 6, 2019

Conversation

yikangfeng
Copy link

Describe what this PR does / why we need it

解决了 #547 我提的issue 存在的问题

Does this pull request fix one issue?

Fixes #547

Describe how you did it

将SimpleDateFormat 包装为ThreadLocal方式来解决多线程安全问题

Describe how to verify it

Special notes for reviews

@CLAassistant
Copy link

CLAassistant commented Mar 6, 2019

CLA assistant check
All committers have signed the CLA.

@sczyh30
Copy link
Member

sczyh30 commented Mar 6, 2019

Hi, thanks for contributing. Could you please sign the CLA here? And please make sure the email of your commits match your GitHub email.


感谢贡献,请将 commit 对应的 email 调整成与 GitHub 的 email 相匹配并 确认一下 CLA。另外请 reformat 相关代码,确保符合 Alibaba Java Code Guideline。

@sczyh30 sczyh30 added the to-review To review label Mar 6, 2019
@codecov-io
Copy link

codecov-io commented Mar 6, 2019

Codecov Report

Merging #548 into master will decrease coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #548      +/-   ##
============================================
- Coverage     37.96%   37.91%   -0.05%     
+ Complexity     1111     1108       -3     
============================================
  Files           259      259              
  Lines          8177     8173       -4     
  Branches       1115     1113       -2     
============================================
- Hits           3104     3099       -5     
- Misses         4668     4670       +2     
+ Partials        405      404       -1
Impacted Files Coverage Δ Complexity Δ
...ava/com/alibaba/csp/sentinel/log/CspFormatter.java 100% <100%> (ø) 4 <3> (ø) ⬇️
...a/csp/sentinel/slots/statistic/base/Striped64.java 56.25% <0%> (-4.17%) 8% <0%> (-2%)
...tinel/slots/block/flow/param/ParamFlowChecker.java 46.75% <0%> (-0.24%) 19% <0%> (-1%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 33fc154...c242b29. Read the comment docs.

@codecov-io
Copy link

Codecov Report

Merging #548 into master will increase coverage by 0.45%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #548      +/-   ##
============================================
+ Coverage     37.51%   37.96%   +0.45%     
- Complexity     1102     1110       +8     
============================================
  Files           259      259              
  Lines          8171     8173       +2     
  Branches       1113     1113              
============================================
+ Hits           3065     3103      +38     
+ Misses         4715     4666      -49     
- Partials        391      404      +13
Impacted Files Coverage Δ Complexity Δ
...ava/com/alibaba/csp/sentinel/log/CspFormatter.java 100% <100%> (ø) 4 <3> (ø) ⬇️
...s/block/flow/controller/RateLimiterController.java 79.31% <0%> (-10.35%) 7% <0%> (-1%)
...a/com/alibaba/csp/sentinel/node/StatisticNode.java 81.96% <0%> (-1.64%) 27% <0%> (-2%)
...a/csp/sentinel/slots/statistic/base/LongAdder.java 31.91% <0%> (+14.89%) 10% <0%> (+6%) ⬆️
...a/csp/sentinel/slots/statistic/base/Striped64.java 60.41% <0%> (+34.37%) 10% <0%> (+5%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d05a603...23a992a. Read the comment docs.

@sczyh30 sczyh30 changed the title 请参照 #547 我提的issue Fix SimpleDateFormat concurrent issue in CspFormatter Mar 6, 2019
修改SimpleDateFormat format方法线程不安全问题

reformat 代码,保持阿里编码规范
Copy link
Member

@sczyh30 sczyh30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sczyh30 sczyh30 merged commit 9ec1985 into alibaba:master Mar 6, 2019
@sczyh30 sczyh30 removed the to-review To review label Mar 6, 2019
@sczyh30 sczyh30 added this to the 1.5.0 milestone Mar 6, 2019
@sczyh30
Copy link
Member

sczyh30 commented Mar 6, 2019

Thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CspFormatter format method in sentinel-core is not thread-safe
4 participants