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

Request for JDK and Spring ThreadPool implementation #64

Merged
merged 39 commits into from
Apr 7, 2020
Merged

Request for JDK and Spring ThreadPool implementation #64

merged 39 commits into from
Apr 7, 2020

Conversation

alaneuler
Copy link
Contributor

fix: #62

@coveralls
Copy link

coveralls commented Mar 26, 2020

Pull Request Test Coverage Report for Build 148

  • 11 of 319 (3.45%) changed or added relevant lines in 8 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.3%) to 21.275%

Changes Missing Coverage Covered Lines Changed/Added Lines %
core/src/main/java/com/alipay/sofa/common/thread/SofaThreadConstants.java 0 1 0.0%
core/src/main/java/com/alipay/sofa/common/utils/ThreadLoggerFactory.java 0 7 0.0%
core/src/main/java/com/alipay/sofa/common/utils/ClassUtil.java 11 19 57.89%
core/src/main/java/com/alipay/sofa/common/thread/NamedThreadFactory.java 0 15 0.0%
core/src/main/java/com/alipay/sofa/common/thread/log/ThreadLogger.java 0 17 0.0%
core/src/main/java/com/alipay/sofa/common/thread/SofaThreadPoolTaskExecutor.java 0 36 0.0%
core/src/main/java/com/alipay/sofa/common/thread/ThreadPoolGovernor.java 0 62 0.0%
core/src/main/java/com/alipay/sofa/common/thread/SofaThreadPoolExecutor.java 0 162 0.0%
Totals Coverage Status
Change from base Build 130: -1.3%
Covered Lines: 998
Relevant Lines: 4691

💛 - Coveralls

pom.xml Outdated Show resolved Hide resolved
@Override
protected void beforeExecute(Thread t, Runnable r) {
super.beforeExecute(t, r);
executingTasks.put(r, new RunnableExecutionInfo(t));
Copy link
Member

Choose a reason for hiding this comment

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

这里的 r 是一个 Runnable 的接口,put 和 remove 应该是根据 equals 来进行对比吧,如果有个使用者定制了 equals 方法导致两个 Runnable 是相等的,那是否会造成这里的计算不准确?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

map 对于 key 相同的判断需要同时 override equals 和 hashcode 两个方法,如果用户的确同时覆盖了这两个方法,那的确是用户的语义就是想要这两个 runnable 相等,我们这里保持一致应该没有问题吧?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

对与 put 覆盖了的情况,第二个 remove 操作不会报错,只是第二个 runnable 会在第一个 runnable 结束之后 remove

@caojie09 caojie09 merged commit 95e2282 into sofastack:master Apr 7, 2020
@alaneuler alaneuler added this to the v1.1.0 milestone Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for JDK/Spring ThreadPoolExecutor logging of decayed tasks
5 participants