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

Simple date format each time new object creation removed #3080

Closed

Conversation

khanimteyaz
Copy link
Contributor

@khanimteyaz khanimteyaz commented Dec 27, 2018

What is the purpose of the change

AcceLogFilter message creation and last and current check was performing by each time simple date formate object creation. In this version of code I have use the ThreadLocal for each thread wise to create simple date format object instead of each call

#3026

In this PR

  1. I have moved the access log creation and writing to file into a single thread and reusing a single instance of SimpleDateFormat
  2. Refactored code to separate our and group related task in separate method and have enhance the readability by using
    - Method naming
    - Reducing big methods to small.

This PR is a resurrection of old 3027 (#3027) PR

Sorry for the inconvenience

Brief changelog

XXXXX

Verifying this change

Runnig UT and verifying generated access log.

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

  • Make sure there is a [GITHUB_issue] (AccessLogFilter simple date format reduce instance creation #3026) field 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.
  • Run mvn clean install -DskipTests=false & 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.

@khanimteyaz
Copy link
Contributor Author

@carryxyh I have raised the PR again for the issue #3026 and have closed the old #3027.

As suggested I have moved the log message creating and writing to single threaded model so that single instance of SimpleDateFormat can be used.

@carryxyh
Copy link
Member

Hi, @khanimteyaz
Nice work.
Your approach is completely in line with my vision. I will review it.

@khanimteyaz
Copy link
Contributor Author

Hi, @khanimteyaz
Nice work.
Your approach is completely in line with my vision. I will review it.

@carryxyh thanks.

beiwei30 and others added 9 commits December 27, 2018 18:48
…orListener.

* refactor ScriptRouter

* refactor TagRouter

* refactor AbstractConfiguratorListener

* make sure parameter should not be null

* correct comments

* make ReferenceConfigurationListener private static

* avoid dup code in init

* add fixme for potential useless code
…/dubbo-registry-default (apache#3053)

* add FailedRetryTaskTest.java
}

private AccessLogData buildAccessLogData(Invoker<?> invoker, Invocation inv) {
RpcContext context = RpcContext.getContext();
Copy link
Member

Choose a reason for hiding this comment

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

How about move this to AccessLogData's constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@carryxyh
Copy link
Member

Would u pls rebase master to fix ci failed?

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@9c0e3ef). Click here to learn what that means.
The diff coverage is 79.44%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #3080   +/-   ##
=========================================
  Coverage          ?   63.59%           
  Complexity        ?       75           
=========================================
  Files             ?      654           
  Lines             ?    28311           
  Branches          ?     4817           
=========================================
  Hits              ?    18004           
  Misses            ?     8040           
  Partials          ?     2267
Impacted Files Coverage Δ Complexity Δ
...tadata/store/redis/RedisMetadataReportFactory.java 100% <ø> (ø) 0 <0> (?)
...ompatibleReferenceAnnotationBeanPostProcessor.java 0% <ø> (ø) 0 <0> (?)
...ory/annotation/CompatibleReferenceBeanBuilder.java 0% <ø> (ø) 0 <0> (?)
.../CompatibleServiceAnnotationBeanPostProcessor.java 0% <ø> (ø) 0 <0> (?)
...ubbo/metadata/store/redis/RedisMetadataReport.java 80% <ø> (ø) 0 <0> (?)
...va/org/apache/dubbo/config/RegistryDataConfig.java 38.46% <ø> (ø) 0 <0> (?)
...apache/dubbo/rpc/cluster/router/tag/TagRouter.java 33.33% <0%> (ø) 0 <0> (?)
.../dubbo/metadata/identifier/MetadataIdentifier.java 46.51% <0%> (ø) 0 <0> (?)
...e/dubbo/registry/integration/RegistryProtocol.java 82.06% <100%> (ø) 0 <0> (?)
...bbo/rpc/cluster/router/file/FileRouterFactory.java 77.77% <100%> (ø) 0 <0> (?)
... and 5 more

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 9c0e3ef...09390e2. Read the comment docs.

@khanimteyaz khanimteyaz deleted the acesslog-dateformat-enhancemnet branch December 28, 2018 15:45
@khanimteyaz
Copy link
Contributor Author

@carryxyh It seems my rebase has introduce lots of commits of others, so raising another PR.

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.

7 participants